mirror of
https://github.com/opencv/opencv.git
synced 2026-07-22 03:43:03 +04:00
Compare commits
1239 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 705e7b207c | |||
| ea91f7e57d | |||
| decdb68636 | |||
| d4cc7f4299 | |||
| 4699d2ba0c | |||
| e8536c4a0e | |||
| 2687a2b6dc | |||
| aab6362705 | |||
| 94e8a08d1d | |||
| ce8027c6fb | |||
| 301c078d19 | |||
| 9485113923 | |||
| 9acbfc6e05 | |||
| 4f3130f562 | |||
| a783bf4a93 | |||
| f7e8dc770a | |||
| 34909d97b4 | |||
| 474a67231c | |||
| a316b11aaa | |||
| b645fc10a3 | |||
| 8e1e08ee38 | |||
| d266fee8bb | |||
| 8357e865bc | |||
| 2c6a2f0381 | |||
| fe9a8ebea2 | |||
| b866d0dc38 | |||
| 2b558a3787 | |||
| 72d06080c6 | |||
| 3cdf926454 | |||
| 23baf1a75e | |||
| 025a9647af | |||
| 32e7ef8a3d | |||
| 2b82f8f12c | |||
| b5c162175b | |||
| 60c76cc289 | |||
| efd556b1a9 | |||
| 3a184ae677 | |||
| b4b2a276c8 | |||
| 464d53bb16 | |||
| 4c9e3723e8 | |||
| 06477743ab | |||
| e4a9ad1730 | |||
| d0b6637c1d | |||
| 58268b6eef | |||
| 14aa8affe5 | |||
| 56074c2eb3 | |||
| 3da1e8b2f8 | |||
| 786cecfe66 | |||
| dde3cb3b99 | |||
| 24f2b7dd3f | |||
| 936530f795 | |||
| cfbdbffcad | |||
| 71db9d3b57 | |||
| b455e1cf52 | |||
| 564d1a0f79 | |||
| 90bea15e35 | |||
| 892cac9e1b | |||
| f58f36dc88 | |||
| 9e84b860f2 | |||
| 2e7ef6f4e8 | |||
| cea137f313 | |||
| 79a82013ad | |||
| 05c011e842 | |||
| 3826158547 | |||
| a7c150ec66 | |||
| 61144f935e | |||
| d23435baac | |||
| 389495f76a | |||
| a3f3fbe05d | |||
| 4d00ed8df7 | |||
| 41e906d1a4 | |||
| 41c2669476 | |||
| 0e4b5b88dc | |||
| 011d8e80d8 | |||
| 1f8f0abe92 | |||
| d9c5b85671 | |||
| 76cf31bee7 | |||
| ed3591ed1f | |||
| d986cc4861 | |||
| 724001aa0f | |||
| 5564d73071 | |||
| 3fc1c73064 | |||
| 1b0dca9c2c | |||
| 5dae278652 | |||
| ef32d7fd16 | |||
| 30d91e8ed6 | |||
| 5f1ca33c6f | |||
| c69417149d | |||
| 08271e5591 | |||
| a104e7c593 | |||
| c3e7a23da5 | |||
| 083edb201c | |||
| df7bf9a048 | |||
| bed5debca6 | |||
| caa1658a4c | |||
| bb5b628cce | |||
| e12adcdf08 | |||
| 127a44f2b9 | |||
| 527cedd848 | |||
| ec5065eb53 | |||
| 90524a8528 | |||
| ad71a1633c | |||
| eb24575e2c | |||
| d9877efe1d | |||
| 7459613623 | |||
| fb69620a27 | |||
| a6e15b2f57 | |||
| 39ecd96b09 | |||
| 21a8d9569d | |||
| 07736c912f | |||
| 24d60da553 | |||
| 039795b405 | |||
| a110ede0a2 | |||
| 2a3cdba724 | |||
| 099ad1a259 | |||
| 6df92b3bca | |||
| 48ccbe39b4 | |||
| 716450ceb5 | |||
| 691c3d1e3c | |||
| ca8bb8d053 | |||
| 56d2b7137c | |||
| d9a62c42e5 | |||
| 97eaddd93b | |||
| e3ce0fbee3 | |||
| 364702b1c9 | |||
| 978f387961 | |||
| 209f6cdcc7 | |||
| 0f7b2eb79f | |||
| 4a0760719e | |||
| d011383a3d | |||
| 1fe276d041 | |||
| f345ed564a | |||
| 3d4563913d | |||
| 93c3775927 | |||
| afbf383ba3 | |||
| 36598677cf | |||
| 0ec94630d4 | |||
| c71f2714c6 | |||
| 71462d9f99 | |||
| 72dfd4846e | |||
| 61a8cf8ba7 | |||
| bd40952097 | |||
| 8869d3212f | |||
| ea1e3fb90d | |||
| 3a99fb9d34 | |||
| e1b56e376e | |||
| aac7c5465b | |||
| 22ee5c0c4d | |||
| e8058b9fdb | |||
| d31b6c3480 | |||
| 95ff928228 | |||
| 510dc17c2e | |||
| 2669d8ce73 | |||
| 7f3d8de26f | |||
| 331b73c8e4 | |||
| 1729297ef3 | |||
| 9138c98b25 | |||
| 456af21d8b | |||
| b87f7a625e | |||
| c3e8790dfd | |||
| bf49149c97 | |||
| 49d5960a32 | |||
| dcfa23d5d2 | |||
| 5ac0712cf1 | |||
| c82417697a | |||
| adac1da64e | |||
| 9c8626bf3c | |||
| ef21fd3cf8 | |||
| bd19f991a5 | |||
| e87ba1d317 | |||
| f9d1f5196a | |||
| b5717f82a0 | |||
| aa51382dbc | |||
| bc6a70c689 | |||
| 1fb6c6e6e5 | |||
| d2dbc9d7a0 | |||
| 8bf451a3e0 | |||
| 0d3e05f9b3 | |||
| 8c4d415412 | |||
| 06a09d5991 | |||
| 57c894f44d | |||
| 7de189114b | |||
| 4c048a487e | |||
| 09a62012b2 | |||
| b494de6a01 | |||
| dbeec7715d | |||
| 25163eb008 | |||
| 1048feac3b | |||
| 96e8b83d41 | |||
| 78476a0fe2 | |||
| d5fd2f0155 | |||
| c8ebe0eb86 | |||
| de93782fab | |||
| 16561ed71e | |||
| 4bfdf7cf2a | |||
| e58da86efc | |||
| 7ed82aea38 | |||
| dc15187f1b | |||
| ae1a249a0a | |||
| 2dd2d60955 | |||
| 171fbf879f | |||
| 1b443219ed | |||
| 8a1caa0d16 | |||
| cdcf7e62f3 | |||
| 083727b0a6 | |||
| 718dd9f170 | |||
| 76be3529f4 | |||
| 6c218c7b0f | |||
| e87a0baa4b | |||
| 8ee5f2ad89 | |||
| ee76cef1ff | |||
| 6a51e3b39a | |||
| 6da05f7086 | |||
| ae265a48c7 | |||
| af2f8c69f0 | |||
| e24b1629a0 | |||
| 46ccde82cf | |||
| 537494f4dd | |||
| d9ea9bedb2 | |||
| 1546b9bf99 | |||
| 39d5e14c1f | |||
| 62b5d37b6b | |||
| d78d9bf151 | |||
| a5f0fb6008 | |||
| f2bb3d0d80 | |||
| d5dce63254 | |||
| 01981ed290 | |||
| 037a72debd | |||
| 1ef4b7ae5a | |||
| b314cc4c23 | |||
| 6f5d56d994 | |||
| 644de8f22a | |||
| 36f61f3879 | |||
| aa11f7d8a3 | |||
| 793b2b9ad9 | |||
| 050c960dfc | |||
| f30aafc3cc | |||
| 2f065b8b4c | |||
| aece3e732e | |||
| aabeb8a18e | |||
| ebe9327a92 | |||
| d7d51e4cc7 | |||
| 102d8f67cd | |||
| a00fe15abd | |||
| 3acf8cfd63 | |||
| 5224d016e9 | |||
| d34717d8c9 | |||
| 199687a1c5 | |||
| b5a6c8e2b2 | |||
| a5b8f163d7 | |||
| 6add3b9161 | |||
| 955909bdb5 | |||
| 1ddd61f98a | |||
| 3503a36e5e | |||
| 2ea7269450 | |||
| a968eadbf1 | |||
| c6b63e0e28 | |||
| 7bd8ddc8fa | |||
| e3da18121f | |||
| 0c4a8e2ca8 | |||
| a3e7c2d8e3 | |||
| 40b8b58bc6 | |||
| fc1a156262 | |||
| 8cbd20b380 | |||
| 43d306fc2d | |||
| 14e264f646 | |||
| 01e23a2222 | |||
| f88d89ad82 | |||
| 969b55036f | |||
| b29f73d5e0 | |||
| e998d89e88 | |||
| 295afd5882 | |||
| cbf978d1f7 | |||
| 94e0ac7d9f | |||
| 08b36e4f48 | |||
| d62d880316 | |||
| 361b5e0ebf | |||
| 8da1b9aafa | |||
| c16e2e6234 | |||
| 19f4cc57c1 | |||
| c08f29c803 | |||
| ecb6d03ccd | |||
| e59793cc75 | |||
| 236ad4aeda | |||
| 97bb91d5fa | |||
| 80d4d4d92c | |||
| 6a7df4e973 | |||
| 098f07664d | |||
| 233030e417 | |||
| 6256e425f3 | |||
| 4dbb8ac4b2 | |||
| 48368dc9a1 | |||
| 691c655630 | |||
| e7f2af5fdb | |||
| 4419f4093e | |||
| b88ad7f2d9 | |||
| b300b6b3bd | |||
| c945ea125a | |||
| c32e349332 | |||
| 118218754b | |||
| 234117800f | |||
| 00c61cf197 | |||
| f6901ab877 | |||
| ac58b2f857 | |||
| 862fc06b6f | |||
| 89ed813585 | |||
| 0dc28d3446 | |||
| 50657e2324 | |||
| 7c22cd49a7 | |||
| 220b37144b | |||
| c012490399 | |||
| e937d9b559 | |||
| 688aea6bec | |||
| 7186c46377 | |||
| 74c8ccb45b | |||
| 3fc1487cc9 | |||
| 48ddb53332 | |||
| 9cfe981e1f | |||
| f584c6d723 | |||
| 3ea9022c5f | |||
| 45ee8e2532 | |||
| 2f9072efdc | |||
| f7b8f522ff | |||
| f6aa9ac304 | |||
| 6c575e8826 | |||
| f52a2cf5e1 | |||
| 5e90802b1a | |||
| 45fee13f3d | |||
| 5bfb779d82 | |||
| 261ad78122 | |||
| 4fa82809df | |||
| 95fd61c9b4 | |||
| d1cdef596c | |||
| 7163781639 | |||
| a63cee2139 | |||
| 3e3787ecb6 | |||
| a723aaedd8 | |||
| 830d8d6b75 | |||
| ebb528976f | |||
| f77c2d700f | |||
| 8c44b8306b | |||
| a07f064e50 | |||
| e668cff573 | |||
| ea4b491a73 | |||
| fa953e4205 | |||
| 986bc65e1f | |||
| 540982cc9d | |||
| 5218443784 | |||
| a61546680b | |||
| 8cb7eae5c9 | |||
| 18440c1faf | |||
| 9f69ca503a | |||
| 49ba744130 | |||
| 3b00ee2afb | |||
| 4b24ddd70d | |||
| 1612db5f91 | |||
| 7dfe68cac6 | |||
| 7d832337ae | |||
| a258404a58 | |||
| 83807811cd | |||
| a3048239b3 | |||
| 23e71d1aa2 | |||
| f787c73841 | |||
| b542a1804c | |||
| 2dff2f36bf | |||
| 1604ea3b27 | |||
| 6b674709b8 | |||
| b23d377567 | |||
| f445b826d0 | |||
| a12ceb04bb | |||
| 623aaaccd4 | |||
| da0fd62c23 | |||
| f56445d7ca | |||
| a10d289997 | |||
| 750b1aba8d | |||
| a3e8c6e866 | |||
| 03bee14372 | |||
| 50ff40d684 | |||
| bfd056ceb1 | |||
| 620629593b | |||
| 05ad3a535f | |||
| 5c76f99fdd | |||
| c31164bf1e | |||
| 3835ab394e | |||
| 20b23da8e2 | |||
| f6795d75a6 | |||
| 36915db699 | |||
| 17640d6008 | |||
| 8711653530 | |||
| 7e019af50d | |||
| 8b61719a9d | |||
| fa11b98800 | |||
| 5ae9892170 | |||
| 6426101433 | |||
| cf8322c0d3 | |||
| 64c67a93d3 | |||
| 0384eb7d8c | |||
| 0c84b91dde | |||
| 154380ccf5 | |||
| 7a796b20ea | |||
| 1f2c83845d | |||
| 71f665bd8c | |||
| 2349a09736 | |||
| 1df533c914 | |||
| 44bf748479 | |||
| 2129c72bc0 | |||
| 0428dce27d | |||
| f9fbd29c14 | |||
| 31dc3e9256 | |||
| 698b2bf729 | |||
| 1d42560018 | |||
| efcf307b4c | |||
| 6876f3b91d | |||
| 60354e3901 | |||
| 2e6e9c14b5 | |||
| 7495a4722f | |||
| 721ab68bec | |||
| 192e5c8166 | |||
| 7ce56b3a47 | |||
| bce5d364df | |||
| 2dfb163281 | |||
| 5376863c0c | |||
| 417d7a38de | |||
| a86e036594 | |||
| ba147d2be2 | |||
| 01324b02e7 | |||
| 792722865f | |||
| 9aa401a7d0 | |||
| a160e4fb6b | |||
| c7422e4d90 | |||
| 1192cbe4ab | |||
| 485d2b593c | |||
| 1bea537731 | |||
| 75e88d613f | |||
| 379b83e946 | |||
| dda1bf1887 | |||
| f7e524cbe6 | |||
| e503ac508e | |||
| 458bd1652d | |||
| f5ba3f51ce | |||
| e5e08ec523 | |||
| d392b11dfb | |||
| cd01ee9a54 | |||
| 8c1af09989 | |||
| 3547ac4b49 | |||
| f6c2bf21c8 | |||
| f53ff0d01c | |||
| 4f48dab023 | |||
| 397ba2d9aa | |||
| a7ffcaab28 | |||
| f617f18e46 | |||
| 4372d75b26 | |||
| da555a2c9b | |||
| 885fb703cf | |||
| cd00d8f3f0 | |||
| b3755e617c | |||
| fc0f9da7a7 | |||
| 277961fa25 | |||
| 8cc2cbf1c4 | |||
| 14a9103fc0 | |||
| 6d1f7c2b1b | |||
| 2c1f3487a4 | |||
| acc6189da0 | |||
| ac177b849c | |||
| d696d7f9ea | |||
| 29aeebf5bc | |||
| 41548a091b | |||
| c9e1386e44 | |||
| cc769ff19d | |||
| 5108e3ced6 | |||
| 8753203df0 | |||
| 1834eed809 | |||
| b34234ac14 | |||
| 7ec9f52509 | |||
| a66f61748f | |||
| b45273eccb | |||
| 68f527267b | |||
| 7f22b34c78 | |||
| ad63d24dba | |||
| 3b5813c035 | |||
| 339b963e6b | |||
| 00890aecdf | |||
| 7fe87d9a5b | |||
| 2171cae8ff | |||
| 3f55152ca0 | |||
| f3cebb3e1b | |||
| 2b227f00f2 | |||
| 98de57c6c4 | |||
| e231be86b7 | |||
| a37f7cce52 | |||
| 7ec221e734 | |||
| 949fe93d5a | |||
| b4e9b4fe7d | |||
| c3ced6db4e | |||
| 0b38571920 | |||
| 2ffe15f22f | |||
| fe9ff64d64 | |||
| 31ddd98c8e | |||
| 3f65c12d0c | |||
| 759c9522fd | |||
| f0149cdae2 | |||
| bedabc15ae | |||
| 565f14655c | |||
| 760e7e8efa | |||
| 336627a776 | |||
| fa25faa2d2 | |||
| 6226ea0085 | |||
| dbab8d8c38 | |||
| 9f02b8742e | |||
| 1067cd0649 | |||
| 1537ecd931 | |||
| 5b5c42d2c7 | |||
| 161890dad4 | |||
| 35846fe735 | |||
| 422f802ec9 | |||
| 5fd3d36fe8 | |||
| 96ce65f021 | |||
| 8457e471fd | |||
| 246de2b7f5 | |||
| e8c26963e9 | |||
| 793e7c0d9f | |||
| 3b337a12c9 | |||
| 2c32cb743c | |||
| 11eff8bae0 | |||
| 883b995fd6 | |||
| 27b2059662 | |||
| a28533933f | |||
| d695208727 | |||
| e6ec42d462 | |||
| 613ff61de7 | |||
| 65b02cc8f2 | |||
| 1c8ee3f957 | |||
| 922108060d | |||
| ce74285c5e | |||
| ff4c3873f2 | |||
| 1192734131 | |||
| c262eea84a | |||
| f2ca7e664a | |||
| cf8f65d806 | |||
| bc221bdb90 | |||
| 29976a04c5 | |||
| a3106d424b | |||
| 77b01deb80 | |||
| f53f491cd2 | |||
| 6bed5c181b | |||
| e421233a1d | |||
| f162c08cda | |||
| 0d1d452b79 | |||
| 3c3e131c38 | |||
| a218cf3c61 | |||
| 866468cc3e | |||
| f66fc199a2 | |||
| 11ac26bfb4 | |||
| 2241bfb0df | |||
| a2f7ef9d21 | |||
| c708f506a4 | |||
| d92af2aa85 | |||
| ae293f27cf | |||
| afe9993376 | |||
| e4d573a080 | |||
| f86c8656a3 | |||
| 6697f0ea86 | |||
| a9f5c19239 | |||
| 53bfdc318a | |||
| e935f06f16 | |||
| 1e18004bdd | |||
| 19646ad049 | |||
| 7e943808b6 | |||
| 88dbee3589 | |||
| 5bfa43f7d5 | |||
| 7ed37b3fa5 | |||
| f0271e54d9 | |||
| 0ac2f0e04c | |||
| ef1690ef45 | |||
| 0fa06b1db0 | |||
| abceef74e0 | |||
| 4cf76754d3 | |||
| 5444a6b11c | |||
| b698d0a6ee | |||
| 11fb04c2f7 | |||
| aaf65bb3af | |||
| 9411cd6c07 | |||
| 9d38a95292 | |||
| 0291dd3ef8 | |||
| a35d4f9029 | |||
| a46ca98c57 | |||
| e65e23b9c0 | |||
| d8b2f11cc8 | |||
| c3bb57afea | |||
| 8a480ac3c1 | |||
| ffe0d50447 | |||
| a199d7adf1 | |||
| 348414dc62 | |||
| 243ce78508 | |||
| 33db2ac928 | |||
| 1fabe92ace | |||
| 4564b8a224 | |||
| 284d26da05 | |||
| 971cc3354b | |||
| e8d4259f9a | |||
| 8086afc60a | |||
| 9b7b22ee0e | |||
| b2ebd37ee2 | |||
| 83e6813345 | |||
| d17ab271e8 | |||
| 09f24a851e | |||
| a216b8bf87 | |||
| 81e027eef7 | |||
| 1c371d07b5 | |||
| 55e8549839 | |||
| f8d6c5b330 | |||
| 435b6df989 | |||
| bf8136eaa6 | |||
| af9ee90091 | |||
| cb2e276bff | |||
| cd0f0384ef | |||
| cc584760d3 | |||
| 5924770504 | |||
| 111cdd7a32 | |||
| 89a17b4232 | |||
| f0c411d8b5 | |||
| e5e767abc1 | |||
| 521aac9665 | |||
| d41b20b268 | |||
| 36da867caf | |||
| c5f540e3d7 | |||
| 1949056423 | |||
| c90e824342 | |||
| 749bd80091 | |||
| 1c0b70bbd2 | |||
| b75f6c05c0 | |||
| 269b810601 | |||
| e54040d540 | |||
| 3d50bde46e | |||
| 0b454486cf | |||
| b96e9a4a4a | |||
| ead1dcf308 | |||
| 553259ef99 | |||
| e18df87a15 | |||
| 5cb8619eca | |||
| 476094ad5a | |||
| ff992183b2 | |||
| d2469edd10 | |||
| 0df8fb70b4 | |||
| 37e2afb8f6 | |||
| 4dd9a36a3c | |||
| 41678fe3d3 | |||
| d0e6d2438c | |||
| a724dc99e8 | |||
| 44d473fba0 | |||
| 5bc6b6fc26 | |||
| 8931c68b20 | |||
| 988bc804bf | |||
| f78f908c09 | |||
| 5487bca4f3 | |||
| 52ac3661b0 | |||
| 27f1ab5a70 | |||
| 762a5c8334 | |||
| 2fed41dfa5 | |||
| 8bf1b9a422 | |||
| e0f9eac521 | |||
| b90a2a8497 | |||
| 950a916952 | |||
| 524a2fffe9 | |||
| 3f13339071 | |||
| eb6678ebef | |||
| 6781ca7d55 | |||
| d62e0a3695 | |||
| dcb7fd8520 | |||
| d5713c657b | |||
| 99c4b76a6d | |||
| e4887aaa5b | |||
| 0970ef57bd | |||
| f98c97f796 | |||
| d69a7a3bbf | |||
| ccf6dd07b3 | |||
| e8129429e9 | |||
| 46d3637609 | |||
| 992c908b56 | |||
| 2566d13100 | |||
| cbdaa93e54 | |||
| 5a15369d4d | |||
| deaf1dd458 | |||
| 65f87b114b | |||
| 8f5b453a96 | |||
| b7eec216e9 | |||
| 4988e131fd | |||
| 17c430da88 | |||
| 96a501c08b | |||
| 657c8d1c65 | |||
| e03891b744 | |||
| dc57707e60 | |||
| 56b5a7d977 | |||
| 65dbbf712d | |||
| 49497d8e7c | |||
| 728684840c | |||
| 73f7d091f8 | |||
| 00e1bc49c8 | |||
| cb3a098b25 | |||
| 5a7045181a | |||
| 6a045fd678 | |||
| 327f92cc46 | |||
| 482cacd420 | |||
| 93a6be836c | |||
| ef7185ce43 | |||
| a5fdcf9881 | |||
| 62a63021c7 | |||
| 33fab84473 | |||
| 0ccc839397 | |||
| 920c180052 | |||
| a711e2aa41 | |||
| a84afb6334 | |||
| ab4065fa1c | |||
| ee73b0bd08 | |||
| e58977a3de | |||
| 31bee49371 | |||
| 48ef6df842 | |||
| 98ad7d01d5 | |||
| cdac7c7bec | |||
| fe09c79f4b | |||
| 206c843f36 | |||
| cabad90d6c | |||
| 4e6a108bda | |||
| 6dba1733f0 | |||
| c62e63909a | |||
| daa88c6b9e | |||
| 9b727fa1f3 | |||
| 7566921364 | |||
| e45d74c8f9 | |||
| 923009b5ff | |||
| 4cec9e5ff1 | |||
| 59ba33658a | |||
| 4064d4c7eb | |||
| e58ce89b10 | |||
| 085bd5f55f | |||
| 6259ba1bfd | |||
| 86905754e4 | |||
| 6044395986 | |||
| eff259b047 | |||
| cd8262eb79 | |||
| d2b854674e | |||
| 4f03f70968 | |||
| ad930f6216 | |||
| f061a0ab36 | |||
| c81d785ada | |||
| 6fb46bb34b | |||
| 2e165053ef | |||
| 8cc8b0d2b4 | |||
| 06b4292534 | |||
| 29f883feee | |||
| 365a10f58c | |||
| 0e69cddda2 | |||
| 3bdd7bfbea | |||
| ad5e70f94e | |||
| 7fae2e834c | |||
| 8e3f5fb209 | |||
| 05fbd1e5bc | |||
| 1491934d17 | |||
| 6573b9ace0 | |||
| ee5ff71d55 | |||
| 6e5f0a2a58 | |||
| 721fac5542 | |||
| fce486c4f9 | |||
| 99bc35a883 | |||
| 63e92cccf2 | |||
| a74ed58893 | |||
| 1b4955342f | |||
| 95ac650af6 | |||
| 2b98aa403e | |||
| 5ed65460d1 | |||
| 0eb7060205 | |||
| 425c653a14 | |||
| 52844614c4 | |||
| 85c0c8c7ed | |||
| a8f04359e8 | |||
| e3d502310f | |||
| cb54f4c2ec | |||
| 77fa1a20bf | |||
| a7cdc42140 | |||
| a8aa9d5ecb | |||
| 52fbfb3ec0 | |||
| d25293b721 | |||
| c07af090f5 | |||
| 456e88a8a4 | |||
| a7cc1159cd | |||
| 6bd87e8146 | |||
| 42a4c3fba6 | |||
| 1cba763189 | |||
| d01cbe9320 | |||
| 9ba5581d17 | |||
| b10ab79743 | |||
| 619462b029 | |||
| 6fdddd53a1 | |||
| d93b6be3cc | |||
| 9755ab160d | |||
| 88a187a737 | |||
| 57f5700e18 | |||
| 2043e06102 | |||
| d84b213f59 | |||
| 177fbc7bbb | |||
| c7dcdc0e88 | |||
| eb67dc9f50 | |||
| 676b818d6a | |||
| 56373428dc | |||
| 411ce04f54 | |||
| 13962b8533 | |||
| 04bee3f9b7 | |||
| 305a245530 | |||
| 74113737f3 | |||
| c244b456f0 | |||
| d321a34f7c | |||
| fb1a58ac76 | |||
| 87ab4ee567 | |||
| 0cbaaba4b1 | |||
| 1644af841b | |||
| b0def9617f | |||
| c2664d912a | |||
| 9697e3ac24 | |||
| d2a9efd039 | |||
| 442999dcdb | |||
| d753ae1489 | |||
| db3e3be8ee | |||
| 0c8da03869 | |||
| 6fbf7042b5 | |||
| 0417c8c9c7 | |||
| d4af89781b | |||
| 265acccd56 | |||
| c6638d62e6 | |||
| a8c1cdf88e | |||
| 7a187e9b5e | |||
| 9096b1c768 | |||
| 781fbde449 | |||
| 55ca0fcc27 | |||
| 1b336bb602 | |||
| 25f3a11a16 | |||
| b1706bc7e5 | |||
| 579d74d35b | |||
| 7ce518106b | |||
| 0fb3b8db72 | |||
| 171cba4947 | |||
| fd498501d6 | |||
| 51bfe74ce1 | |||
| 5f3012fc9a | |||
| b44302382d | |||
| 0f3c82e73b | |||
| 458f1d5ebe | |||
| a43e3bebe6 | |||
| f62fe956d1 | |||
| 02385472b6 | |||
| f30b5995b6 | |||
| 852b0226e0 | |||
| 89a6937c00 | |||
| 08a3eef62a | |||
| 434014b05e | |||
| 29ff1129fb | |||
| 5906b49bd1 | |||
| b03ed532cf | |||
| 7d30e19b3e | |||
| b083c20eb2 | |||
| 7722a2b8a8 | |||
| ef3844a177 | |||
| 476aa443c6 | |||
| cb0f74ab9f | |||
| 977e5afbac | |||
| 08d1c54364 | |||
| dbbfa003d3 | |||
| a17d1843fb | |||
| 5ffc5bca7c | |||
| 11ac2e1475 | |||
| 59608907b8 | |||
| e454c4891e | |||
| 3ed243abde | |||
| d60524ecfa | |||
| 345e071b24 | |||
| be1a121d0d | |||
| 156406b56c | |||
| f68654a204 | |||
| 8abb312c20 | |||
| adcb943f61 | |||
| 5489735258 | |||
| 8de176988d | |||
| 79c5d07abe | |||
| 74020a084b | |||
| 09acd478f1 | |||
| e6c9e2fa50 | |||
| ab2c59b80e | |||
| a5209c4882 | |||
| f1dd5e49c5 | |||
| c6b60e219d | |||
| 740f6628ec | |||
| 821fac187c | |||
| 73fdf75328 | |||
| f7daa9e4f5 | |||
| c3e8a82c9c | |||
| d3aaf2d3a3 | |||
| e58e545584 | |||
| 319db07b6b | |||
| 407cc5f1b6 | |||
| 80037dc6de | |||
| d9bada9867 | |||
| 6b89154afd | |||
| 1f2d4e4839 | |||
| 4a9904fe62 | |||
| 4b5fdc6bb2 | |||
| 2d11edd103 | |||
| 515a06cedf | |||
| fef6192bca | |||
| 7d9e1be588 | |||
| ba3cf47600 | |||
| 9e09828cc3 | |||
| b236f10792 | |||
| f0bef94a03 | |||
| 9f177b2bcd | |||
| 765f333a1d | |||
| 1bec7ca540 | |||
| 29bbbaa0a7 | |||
| 4e97c69792 | |||
| 88d8a48b09 | |||
| 73aa5f567b | |||
| d5e8792f55 | |||
| 6202556fc0 | |||
| be9f3826d7 | |||
| 7f453ade73 | |||
| 5393185add | |||
| b3a261c7ce | |||
| 9fef09fe89 | |||
| 6b0fff72d9 | |||
| 21e28adb87 | |||
| a9b030591b | |||
| 57ca10636c | |||
| d4a9c731ff | |||
| 17d15df6cd | |||
| 98611adeb9 | |||
| 01a8c9ca8d | |||
| 0940c56a3f | |||
| d650b5cc5a | |||
| e96a58f091 | |||
| b624da27bd | |||
| 5b443199ca | |||
| cb82388a84 | |||
| 735c31bb4a | |||
| b7253e3280 | |||
| e02318d384 | |||
| 94d187e269 | |||
| d991c22090 | |||
| 9039284d96 | |||
| 593af7287b | |||
| 322960f795 | |||
| b5035ce991 | |||
| 07c56f149f | |||
| c0f435349a | |||
| 0e1c7eda39 | |||
| 2b2bcc9b38 | |||
| a3b109eca0 | |||
| a1b09a3734 | |||
| d81ac52ce2 | |||
| 220df8252d | |||
| de720ac34a | |||
| 68d59a2913 | |||
| 5ecf5f106a | |||
| 753e417dec | |||
| 7d1094b7e1 | |||
| 5b095dfcb6 | |||
| 7c41b54e3d | |||
| 58426c80a3 | |||
| cddd7f10d5 | |||
| ea3c2307dc | |||
| 65b3209441 | |||
| 400a781ebf | |||
| c8689d9d0a | |||
| ea0d1424d8 | |||
| 365f44b094 | |||
| bcf96d637e | |||
| 6ced54a892 | |||
| 486de65067 | |||
| c5a2d28367 | |||
| b4a6aa335d | |||
| 35245cb76e | |||
| fa349b7a4e | |||
| df305e83fa | |||
| b2464e3379 | |||
| 06bff34a6b | |||
| 6856cc7253 | |||
| 508bd3f55d | |||
| 8b51e2df8b | |||
| bd1b252de9 | |||
| 77ddfa2fc9 | |||
| f30931848e | |||
| b27ae9c63b | |||
| 79f8b7fd73 | |||
| 48e9e651a4 | |||
| 7386d8523b | |||
| 1bf353b876 | |||
| 23e336ee53 | |||
| ac54bb193c | |||
| 713577b257 | |||
| 583f4b9633 | |||
| 45a6386e45 | |||
| e9058ea8f5 | |||
| 3c35b563d7 | |||
| fd06139c20 | |||
| b43da8aa5d | |||
| 066259b656 | |||
| d981d04c76 | |||
| 666be238d8 | |||
| 64f5471b2a | |||
| 4e789635c9 | |||
| 7c17695be4 | |||
| 3e3d4ad797 | |||
| 73bbabcd04 | |||
| 93d79d2e5d | |||
| 1889d72889 | |||
| 6e5437a582 | |||
| 09799402f9 | |||
| 5813d2439c | |||
| 4f1ba5e69e | |||
| c934d9c3cc | |||
| 00b19d6fba | |||
| 8b13b85c5e | |||
| 64b0757758 | |||
| 1622e7cc90 | |||
| 1f9713195b | |||
| ea04f9d12e | |||
| 74e4cfd1da | |||
| 27ee6501eb | |||
| a5696da9ec | |||
| 0b439bcd08 | |||
| b805115c1a | |||
| c41fb45da3 | |||
| cdfa58dde0 | |||
| c722625f28 | |||
| 6630eac813 | |||
| 63f5f93063 | |||
| 1d30a524fa | |||
| 7f90f04df2 | |||
| 5da4bb7e88 | |||
| dc1b1f2cd7 | |||
| 25ec4ce6f1 | |||
| d30bc0a4c0 | |||
| c05ac8729e | |||
| 9926a93a78 | |||
| 7093752cb5 | |||
| 0daf055fe6 | |||
| 3f38edfd61 | |||
| ee201f4df5 | |||
| 7228d2a824 | |||
| 9181ecfc7b | |||
| 4bf94cb5d1 | |||
| 599a3026d1 | |||
| 288fa70ed9 | |||
| 152e6476d9 | |||
| 8d05dab32c | |||
| 3c14a8c507 | |||
| 15b948d109 | |||
| ab3b1e9922 | |||
| cd7db168e0 | |||
| cbcdbde29d | |||
| aff2c7c43c | |||
| 2df978b8e7 | |||
| 10808ccbb4 | |||
| f756923271 | |||
| 51a42c0647 | |||
| 189fc43765 | |||
| a327418767 | |||
| a1641f938e | |||
| 351fb8c058 | |||
| 83c4378d5d | |||
| 561421f748 | |||
| 9415560250 | |||
| e74075c689 | |||
| 511d0fe198 | |||
| 1c1762d3f6 | |||
| e0ac0cfbe2 | |||
| bfcc136dc7 | |||
| 775d031366 | |||
| 1a17f402a4 | |||
| 40973bea31 | |||
| 94e36d8c8d | |||
| 4ee6852a1e | |||
| 0be2c7018b | |||
| aa08900ac8 | |||
| 05d5c284f6 | |||
| d37180a2c4 | |||
| 8badf7f354 | |||
| 150bd3aee6 | |||
| f19d0ae41d | |||
| a748eba42e | |||
| 850b1ea2d7 | |||
| 10d2bcc8a2 | |||
| 7ce1bd5d88 | |||
| 935420217c | |||
| 81d4d4948e | |||
| 041da57e87 | |||
| acf1be547d | |||
| 908bf935f7 | |||
| e59e978fcd | |||
| fbaae7ac37 | |||
| dcf7eb972e | |||
| 2840362868 | |||
| d4fc302c7e | |||
| 1cce9db710 | |||
| e92f1eaa3d | |||
| f84cae833a | |||
| 2cef100303 | |||
| ed58b5489f | |||
| ef5fa498d4 | |||
| 78e4fbd2d7 | |||
| 96075ce0c9 | |||
| c007228d0f | |||
| dca9b4283b | |||
| dcec3150f0 | |||
| d015db3de8 | |||
| ef7fb905aa | |||
| 5e5385a814 | |||
| 7aaa918367 | |||
| c2e484a465 | |||
| f64d807863 | |||
| 81c2f3d194 | |||
| 8c77f35fce | |||
| ff4ce9f7b1 | |||
| fecebea2e3 | |||
| f39784c584 | |||
| 98e38b2a41 | |||
| 1d8c73cf6c | |||
| ef68cc3d5f | |||
| 18550b4601 | |||
| 07a0274507 | |||
| 8ff0399432 | |||
| c8f1948d58 | |||
| f6de25b6cb | |||
| b3514a5708 | |||
| dd2c7c5140 | |||
| 91b0100287 | |||
| 870a775d7d | |||
| 575a609b80 | |||
| ca9756f6a1 | |||
| 675342ecd9 | |||
| 245b2fec34 | |||
| 49a75079f2 | |||
| d3f9ad1145 | |||
| 46615ffc4a | |||
| f351653589 | |||
| f0ffc52435 | |||
| f7d029cfce | |||
| 1eb63cfc42 | |||
| 43ff8f8e8d | |||
| b11a3a0820 | |||
| bef6b6282c | |||
| 9c58a7cb1e | |||
| 69ac19d82d | |||
| b77fe9d624 | |||
| 0556450801 | |||
| 5c7c80dd27 | |||
| d7abb641ca | |||
| 4e75f31c55 | |||
| 1537a5f253 | |||
| ce772b346c | |||
| e1f14fcac7 | |||
| 39d3bbb601 | |||
| b1f42a6506 | |||
| cb5921b375 | |||
| 016f9ab16e | |||
| 499e20da4f | |||
| d50c21e571 | |||
| 4d35a46c48 | |||
| 676d1dfd5b | |||
| 2c9d149ac2 | |||
| 06bf845783 | |||
| acede976e4 | |||
| 90e7c29c46 | |||
| ca6a11e4d2 | |||
| f496a37340 | |||
| b8579f12be | |||
| b745e1c43a | |||
| 21ed892489 | |||
| 5504d94e36 | |||
| 31ec9b2aa7 | |||
| 0c2a43923c | |||
| 63320aba6c | |||
| 2fe9c87433 | |||
| adf54d41d5 | |||
| ab4dbff150 | |||
| 75bd9f86b2 | |||
| 734771418e | |||
| 01a85736e6 | |||
| 51a8885566 | |||
| 7d5a8053d7 | |||
| 60c382d8f1 | |||
| 3371e679ce | |||
| b8cf5d8d5f | |||
| 43df944eb4 | |||
| ce5626db45 | |||
| 763a1d7392 | |||
| 1377b9b736 | |||
| 5db3092a1f | |||
| be1615b1c3 | |||
| 936428cb3b | |||
| ca9fd66744 | |||
| bdc95d2c66 | |||
| c305455cb2 | |||
| 8334932a26 | |||
| a10385543b | |||
| 99d29c9d39 | |||
| a448d3a6aa | |||
| e80adc0bc6 | |||
| 1a6b4d6ce6 | |||
| a15417fe74 | |||
| 1b5730a799 | |||
| 3dcb775d16 | |||
| 2d387356de | |||
| 07c3aae315 | |||
| b36eba7fab | |||
| 8574a757f9 | |||
| 01dcfb0825 | |||
| c8776e6ebd | |||
| 3ffed0bf6e | |||
| faceb05775 | |||
| 7e4b2057f2 | |||
| 65ccafd494 | |||
| 6c93e42d94 | |||
| 2947877871 | |||
| fadb90c579 | |||
| dfb9832a25 | |||
| fd46684bf8 | |||
| 9badb0d903 | |||
| c5f06814bc | |||
| 69d43e2997 | |||
| 0f0dea79fc | |||
| b6d636214e | |||
| 4b64955a12 | |||
| 546239a3a8 | |||
| 8be0a3452d | |||
| 99d914ea3b | |||
| 24284d3d17 | |||
| 9fc872b70b | |||
| e3654d5416 | |||
| d92bee821d | |||
| df10411e05 | |||
| 44e9fb306d |
@@ -54,7 +54,7 @@
|
||||
to reduce attachment size
|
||||
* Use PNG for images, if you report some CV related bug, but not image reader
|
||||
issue
|
||||
* Attach the image as archite to the ticket, if you report some reader issue.
|
||||
* Attach the image as archive to the ticket, if you report some reader issue.
|
||||
Image hosting services compress images and it breaks the repro code.
|
||||
* Provide ONNX file for some public model or ONNX file with with random weights,
|
||||
if you report ONNX parsing or handling issue. Architecture details diagram
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
|
||||
|
||||
- [ ] I agree to contribute to the project under OpenCV (BSD) License.
|
||||
- [ ] I agree to contribute to the project under Apache 2 License.
|
||||
- [ ] To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
|
||||
- [ ] The PR is proposed to proper branch
|
||||
- [ ] There is reference to original bug report and related work
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
name: arm64 build checks
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependency packages
|
||||
run: |
|
||||
sudo sed -i -E 's|^deb ([^ ]+) (.*)$|deb [arch=amd64] \1 \2\ndeb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ \2|' /etc/apt/sources.list
|
||||
sudo dpkg --add-architecture arm64
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
crossbuild-essential-arm64 \
|
||||
git \
|
||||
cmake \
|
||||
libpython-dev:arm64 \
|
||||
libpython3-dev:arm64 \
|
||||
python-numpy \
|
||||
python3-numpy
|
||||
|
||||
- name: Fetch opencv_contrib
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/opencv/opencv_contrib.git ../opencv_contrib
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DPYTHON2_INCLUDE_PATH=/usr/include/python2.7/ \
|
||||
-DPYTHON2_LIBRARIES=/usr/lib/aarch64-linux-gnu/libpython2.7.so \
|
||||
-DPYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include \
|
||||
-DPYTHON3_INCLUDE_PATH=/usr/include/python3.6m/ \
|
||||
-DPYTHON3_LIBRARIES=/usr/lib/aarch64-linux-gnu/libpython3.6m.so \
|
||||
-DPYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../platforms/linux/aarch64-gnu.toolchain.cmake \
|
||||
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
|
||||
../
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd build
|
||||
make -j$(nproc --all)
|
||||
@@ -24,3 +24,4 @@ bin/
|
||||
build
|
||||
node_modules
|
||||
CMakeSettings.json
|
||||
xcuserdata/
|
||||
|
||||
Vendored
+3
-2
@@ -27,7 +27,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(carotene_objs OBJECT
|
||||
add_library(carotene_objs OBJECT EXCLUDE_FROM_ALL
|
||||
${carotene_headers}
|
||||
${carotene_sources}
|
||||
)
|
||||
@@ -40,4 +40,5 @@ if(WITH_NEON)
|
||||
target_compile_definitions(carotene_objs PRIVATE "-DWITH_NEON")
|
||||
endif()
|
||||
|
||||
add_library(carotene STATIC EXCLUDE_FROM_ALL "$<TARGET_OBJECTS:carotene_objs>")
|
||||
# we add dummy file to fix XCode build
|
||||
add_library(carotene STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} "$<TARGET_OBJECTS:carotene_objs>" "${CAROTENE_SOURCE_DIR}/dummy.cpp")
|
||||
|
||||
Vendored
+2
-1
@@ -82,7 +82,8 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${carotene_defs})
|
||||
# set_source_files_properties(impl.cpp $<TARGET_OBJECTS:carotene_objs> COMPILE_FLAGS "--param ipcp-unit-growth=100000 --param inline-unit-growth=100000 --param large-stack-frame-growth=5000")
|
||||
endif()
|
||||
|
||||
add_library(tegra_hal STATIC $<TARGET_OBJECTS:carotene_objs>)
|
||||
# we add dummy file to fix XCode build
|
||||
add_library(tegra_hal STATIC $<TARGET_OBJECTS:carotene_objs> "dummy.cpp")
|
||||
set_target_properties(tegra_hal PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH})
|
||||
set(OPENCV_SRC_DIR "${CMAKE_SOURCE_DIR}")
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// This file is needed for compilation on some platforms e.g. with XCode generator
|
||||
// Related issue: https://gitlab.kitware.com/cmake/cmake/-/issues/17457
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
// This file is needed for compilation on some platforms e.g. with XCode generator
|
||||
// Related issue: https://gitlab.kitware.com/cmake/cmake/-/issues/17457
|
||||
Vendored
+2
-2
@@ -14,7 +14,7 @@ if(NOT DEFINED CPUFEATURES_SOURCES)
|
||||
endif()
|
||||
|
||||
include_directories(${CPUFEATURES_INCLUDE_DIRS})
|
||||
add_library(${OPENCV_CPUFEATURES_TARGET_NAME} STATIC ${CPUFEATURES_SOURCES})
|
||||
add_library(${OPENCV_CPUFEATURES_TARGET_NAME} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${CPUFEATURES_SOURCES})
|
||||
|
||||
set_target_properties(${OPENCV_CPUFEATURES_TARGET_NAME}
|
||||
PROPERTIES OUTPUT_NAME cpufeatures
|
||||
@@ -29,7 +29,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${OPENCV_CPUFEATURES_TARGET_NAME} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${OPENCV_CPUFEATURES_TARGET_NAME} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(cpufeatures LICENSE README.md)
|
||||
|
||||
Vendored
+6
-6
@@ -1,9 +1,9 @@
|
||||
# Binaries branch name: ffmpeg/master_20200311
|
||||
# Binaries were created for OpenCV: 850414a501d5e6dba111c92d73fdd05794c7061d
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "3d2e97081683265950316c65a52c2e8858ffba1b")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "3b094c37d270a30f0b20a0bc8d3ecafb")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "388ee23a7ca44eef2344e265fafd5940")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "ad57c038ba34b868277ccbe6dd0f9602")
|
||||
# Binaries branch name: ffmpeg/master_20200908
|
||||
# Binaries were created for OpenCV: f445b826d084188077a5e9d204c4c33d1589f380
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "6152e132572dfdaa32887eabeb7199bef49b14dc")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "37e2dadf776631acc8856e281f29cf42")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "cf5dba83edf8619f57ccff4edb989c62")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "f8e65dbe4a3b4eedc0d2997e07c3f3fd")
|
||||
|
||||
function(download_win_ffmpeg script_var)
|
||||
set(${script_var} "" PARENT_SCOPE)
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2020 The Khronos Group Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
/*****************************************************************************\
|
||||
|
||||
Copyright (c) 2013-2019 Intel Corporation All Rights Reserved.
|
||||
|
||||
THESE MATERIALS ARE 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 INTEL OR ITS
|
||||
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 THESE
|
||||
MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
File Name: cl_va_api_media_sharing_intel.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Notes:
|
||||
|
||||
\*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H
|
||||
#define __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
#include <va/va.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************
|
||||
* cl_intel_va_api_media_sharing extension *
|
||||
*******************************************/
|
||||
|
||||
#define cl_intel_va_api_media_sharing 1
|
||||
|
||||
/* error codes */
|
||||
#define CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL -1098
|
||||
#define CL_INVALID_VA_API_MEDIA_SURFACE_INTEL -1099
|
||||
#define CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL -1100
|
||||
#define CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL -1101
|
||||
|
||||
/* cl_va_api_device_source_intel */
|
||||
#define CL_VA_API_DISPLAY_INTEL 0x4094
|
||||
|
||||
/* cl_va_api_device_set_intel */
|
||||
#define CL_PREFERRED_DEVICES_FOR_VA_API_INTEL 0x4095
|
||||
#define CL_ALL_DEVICES_FOR_VA_API_INTEL 0x4096
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_VA_API_DISPLAY_INTEL 0x4097
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_VA_API_MEDIA_SURFACE_INTEL 0x4098
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_VA_API_PLANE_INTEL 0x4099
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_ACQUIRE_VA_API_MEDIA_SURFACES_INTEL 0x409A
|
||||
#define CL_COMMAND_RELEASE_VA_API_MEDIA_SURFACES_INTEL 0x409B
|
||||
|
||||
typedef cl_uint cl_va_api_device_source_intel;
|
||||
typedef cl_uint cl_va_api_device_set_intel;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetDeviceIDsFromVA_APIMediaAdapterINTEL(
|
||||
cl_platform_id platform,
|
||||
cl_va_api_device_source_intel media_adapter_type,
|
||||
void* media_adapter,
|
||||
cl_va_api_device_set_intel media_adapter_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id* devices,
|
||||
cl_uint* num_devices) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL * clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_va_api_device_source_intel media_adapter_type,
|
||||
void* media_adapter,
|
||||
cl_va_api_device_set_intel media_adapter_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id* devices,
|
||||
cl_uint* num_devices) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromVA_APIMediaSurfaceINTEL(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
VASurfaceID* surface,
|
||||
cl_uint plane,
|
||||
cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL * clCreateFromVA_APIMediaSurfaceINTEL_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
VASurfaceID* surface,
|
||||
cl_uint plane,
|
||||
cl_int* errcode_ret) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireVA_APIMediaSurfacesINTEL(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list,
|
||||
cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list,
|
||||
cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseVA_APIMediaSurfacesINTEL(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list,
|
||||
cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem* mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event* event_wait_list,
|
||||
cl_event* event) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H */
|
||||
|
||||
Vendored
+2
-2
@@ -17,7 +17,7 @@ file(GLOB lib_hdrs ${IPP_IW_PATH}/include/*.h ${IPP_IW_PATH}/include/iw/*.h ${IP
|
||||
# Define the library target:
|
||||
# ----------------------------------------------------------------------------------
|
||||
|
||||
add_library(${IPP_IW_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
||||
add_library(${IPP_IW_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs})
|
||||
|
||||
if(UNIX)
|
||||
if(CV_GCC OR CV_CLANG OR CV_ICC)
|
||||
@@ -41,5 +41,5 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${IPP_IW_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${IPP_IW_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
Vendored
+2
-2
@@ -37,7 +37,7 @@ set(ITT_SRCS
|
||||
src/ittnotify/jitprofiling.c
|
||||
)
|
||||
|
||||
add_library(${ITT_LIBRARY} STATIC ${ITT_SRCS} ${ITT_PUBLIC_HDRS} ${ITT_PRIVATE_HDRS})
|
||||
add_library(${ITT_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${ITT_SRCS} ${ITT_PUBLIC_HDRS} ${ITT_PRIVATE_HDRS})
|
||||
|
||||
if(NOT WIN32)
|
||||
if(HAVE_DL_LIBRARY)
|
||||
@@ -60,7 +60,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${ITT_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${ITT_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(ittnotify src/ittnotify/LICENSE.BSD src/ittnotify/LICENSE.GPL)
|
||||
|
||||
Vendored
+2
-2
@@ -17,7 +17,7 @@ file(GLOB lib_ext_hdrs jasper/*.h)
|
||||
# Define the library target:
|
||||
# ----------------------------------------------------------------------------------
|
||||
|
||||
add_library(${JASPER_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
|
||||
add_library(${JASPER_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
add_definitions(-DJAS_WIN_MSVC_BUILD)
|
||||
@@ -46,7 +46,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${JASPER_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${JASPER_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(jasper LICENSE README copyright)
|
||||
|
||||
+6
-4
@@ -4,9 +4,9 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-6
|
||||
|
||||
set(VERSION_MAJOR 2)
|
||||
set(VERSION_MINOR 0)
|
||||
set(VERSION_REVISION 4)
|
||||
set(VERSION_REVISION 6)
|
||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
|
||||
set(LIBJPEG_TURBO_VERSION_NUMBER 2000004)
|
||||
set(LIBJPEG_TURBO_VERSION_NUMBER 2000006)
|
||||
|
||||
string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo")
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
@@ -65,6 +65,8 @@ set(JPEG_LIB_VERSION 62)
|
||||
# OpenCV
|
||||
set(JPEG_LIB_VERSION "${VERSION}-${JPEG_LIB_VERSION}" PARENT_SCOPE)
|
||||
|
||||
set(THREAD_LOCAL "") # WITH_TURBOJPEG is not used
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-W3 -wd4996 -wd4018)
|
||||
endif()
|
||||
@@ -104,7 +106,7 @@ set(JPEG_SOURCES ${JPEG_SOURCES} jsimd_none.c)
|
||||
|
||||
ocv_list_add_prefix(JPEG_SOURCES src/)
|
||||
|
||||
add_library(${JPEG_LIBRARY} STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
|
||||
add_library(${JPEG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${JPEG_SOURCES} ${SIMD_OBJS})
|
||||
|
||||
set_target_properties(${JPEG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
||||
@@ -119,7 +121,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(libjpeg-turbo README.md LICENSE.md README.ijg)
|
||||
|
||||
Vendored
+1
-1
@@ -91,7 +91,7 @@ best of our understanding.
|
||||
The Modified (3-clause) BSD License
|
||||
===================================
|
||||
|
||||
Copyright (C)2009-2019 D. R. Commander. All Rights Reserved.
|
||||
Copyright (C)2009-2020 D. R. Commander. All Rights Reserved.
|
||||
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Vendored
+8
-14
@@ -223,12 +223,12 @@ https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
|
||||
A PDF file of the older JFIF 1.02 specification is available at
|
||||
http://www.w3.org/Graphics/JPEG/jfif3.pdf.
|
||||
|
||||
The TIFF 6.0 file format specification can be obtained by FTP from
|
||||
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
|
||||
found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems.
|
||||
IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6).
|
||||
Instead, we recommend the JPEG design proposed by TIFF Technical Note #2
|
||||
(Compression tag 7). Copies of this Note can be obtained from
|
||||
The TIFF 6.0 file format specification can be obtained from
|
||||
http://mirrors.ctan.org/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation
|
||||
scheme found in the TIFF 6.0 spec of 3-June-92 has a number of serious
|
||||
problems. IJG does not recommend use of the TIFF 6.0 design (TIFF Compression
|
||||
tag 6). Instead, we recommend the JPEG design proposed by TIFF Technical Note
|
||||
#2 (Compression tag 7). Copies of this Note can be obtained from
|
||||
http://www.ijg.org/files/. It is expected that the next revision
|
||||
of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
|
||||
Although IJG's own code does not support TIFF/JPEG, the free libtiff library
|
||||
@@ -243,14 +243,8 @@ The most recent released version can always be found there in
|
||||
directory "files".
|
||||
|
||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||
general information about JPEG.
|
||||
It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/
|
||||
and other news.answers archive sites, including the official news.answers
|
||||
archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/.
|
||||
If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu
|
||||
with body
|
||||
send usenet/news.answers/jpeg-faq/part1
|
||||
send usenet/news.answers/jpeg-faq/part2
|
||||
general information about JPEG. It is available at
|
||||
http://www.faqs.org/faqs/jpeg-faq.
|
||||
|
||||
|
||||
FILE FORMAT COMPATIBILITY
|
||||
|
||||
Vendored
+11
-10
@@ -2,7 +2,7 @@ Background
|
||||
==========
|
||||
|
||||
libjpeg-turbo is a JPEG image codec that uses SIMD instructions to accelerate
|
||||
baseline JPEG compression and decompression on x86, x86-64, ARM, PowerPC, and
|
||||
baseline JPEG compression and decompression on x86, x86-64, Arm, PowerPC, and
|
||||
MIPS systems, as well as progressive JPEG compression on x86 and x86-64
|
||||
systems. On such systems, libjpeg-turbo is generally 2-6x as fast as libjpeg,
|
||||
all else being equal. On other types of systems, libjpeg-turbo can still
|
||||
@@ -179,8 +179,8 @@ supported and which aren't.
|
||||
|
||||
NOTE: As of this writing, extensive research has been conducted into the
|
||||
usefulness of DCT scaling as a means of data reduction and SmartScale as a
|
||||
means of quality improvement. The reader is invited to peruse the research at
|
||||
<http://www.libjpeg-turbo.org/About/SmartScale> and draw his/her own conclusions,
|
||||
means of quality improvement. Readers are invited to peruse the research at
|
||||
<http://www.libjpeg-turbo.org/About/SmartScale> and draw their own conclusions,
|
||||
but it is the general belief of our project that these features have not
|
||||
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
||||
|
||||
@@ -287,12 +287,13 @@ following reasons:
|
||||
(and slightly faster) floating point IDCT algorithm introduced in libjpeg
|
||||
v8a as opposed to the algorithm used in libjpeg v6b. It should be noted,
|
||||
however, that this algorithm basically brings the accuracy of the floating
|
||||
point IDCT in line with the accuracy of the slow integer IDCT. The floating
|
||||
point DCT/IDCT algorithms are mainly a legacy feature, and they do not
|
||||
produce significantly more accuracy than the slow integer algorithms (to put
|
||||
numbers on this, the typical difference in PNSR between the two algorithms
|
||||
is less than 0.10 dB, whereas changing the quality level by 1 in the upper
|
||||
range of the quality scale is typically more like a 1.0 dB difference.)
|
||||
point IDCT in line with the accuracy of the accurate integer IDCT. The
|
||||
floating point DCT/IDCT algorithms are mainly a legacy feature, and they do
|
||||
not produce significantly more accuracy than the accurate integer algorithms
|
||||
(to put numbers on this, the typical difference in PNSR between the two
|
||||
algorithms is less than 0.10 dB, whereas changing the quality level by 1 in
|
||||
the upper range of the quality scale is typically more like a 1.0 dB
|
||||
difference.)
|
||||
|
||||
- If the floating point algorithms in libjpeg-turbo are not implemented using
|
||||
SIMD instructions on a particular platform, then the accuracy of the
|
||||
@@ -340,7 +341,7 @@ The algorithm used by the SIMD-accelerated quantization function cannot produce
|
||||
correct results whenever the fast integer forward DCT is used along with a JPEG
|
||||
quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
|
||||
function in those cases. This causes performance to drop by as much as 40%.
|
||||
It is therefore strongly advised that you use the slow integer forward DCT
|
||||
It is therefore strongly advised that you use the accurate integer forward DCT
|
||||
whenever encoding images with a JPEG quality of 98 or higher.
|
||||
|
||||
|
||||
|
||||
+3
@@ -15,6 +15,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* How to obtain thread-local storage */
|
||||
#define THREAD_LOCAL @THREAD_LOCAL@
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -34,10 +34,10 @@
|
||||
* memory footprint by 64k, which is important for some mobile applications
|
||||
* that create many isolated instances of libjpeg-turbo (web browsers, for
|
||||
* instance.) This may improve performance on some mobile platforms as well.
|
||||
* This feature is enabled by default only on ARM processors, because some x86
|
||||
* This feature is enabled by default only on Arm processors, because some x86
|
||||
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
|
||||
* shown to have a significant performance impact even on the x86 chips that
|
||||
* have a fast implementation of it. When building for ARMv6, you can
|
||||
* have a fast implementation of it. When building for Armv6, you can
|
||||
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
|
||||
* flags (this defines __thumb__).
|
||||
*/
|
||||
|
||||
Vendored
+4
-1
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* jcinit.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -19,6 +21,7 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jpegcomp.h"
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Vendored
+2
-2
@@ -43,10 +43,10 @@
|
||||
* memory footprint by 64k, which is important for some mobile applications
|
||||
* that create many isolated instances of libjpeg-turbo (web browsers, for
|
||||
* instance.) This may improve performance on some mobile platforms as well.
|
||||
* This feature is enabled by default only on ARM processors, because some x86
|
||||
* This feature is enabled by default only on Arm processors, because some x86
|
||||
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
|
||||
* shown to have a significant performance impact even on the x86 chips that
|
||||
* have a fast implementation of it. When building for ARMv6, you can
|
||||
* have a fast implementation of it. When building for Armv6, you can
|
||||
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
|
||||
* flags (this defines __thumb__).
|
||||
*/
|
||||
|
||||
Vendored
+3
-2
@@ -4,8 +4,8 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1995-1998, Thomas G. Lane.
|
||||
* Modified 2000-2009 by Guido Vollbeding.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -17,6 +17,7 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jpegcomp.h"
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
+36
-9
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2015-2018, D. R. Commander.
|
||||
* Copyright (C) 2010, 2015-2018, 2020, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "jinclude.h"
|
||||
#include "jdmainct.h"
|
||||
#include "jdcoefct.h"
|
||||
#include "jdmaster.h"
|
||||
#include "jdmerge.h"
|
||||
#include "jdsample.h"
|
||||
#include "jmemsys.h"
|
||||
|
||||
@@ -316,6 +318,8 @@ LOCAL(void)
|
||||
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
{
|
||||
JDIMENSION n;
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
JSAMPARRAY scanlines = NULL;
|
||||
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION input_row, JSAMPARRAY output_buf,
|
||||
int num_rows) = NULL;
|
||||
@@ -332,8 +336,13 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->cquantize->color_quantize = noop_quantize;
|
||||
}
|
||||
|
||||
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
scanlines = &upsample->spare_row;
|
||||
}
|
||||
|
||||
for (n = 0; n < num_lines; n++)
|
||||
jpeg_read_scanlines(cinfo, NULL, 1);
|
||||
jpeg_read_scanlines(cinfo, scanlines, 1);
|
||||
|
||||
if (color_convert)
|
||||
cinfo->cconvert->color_convert = color_convert;
|
||||
@@ -353,6 +362,12 @@ increment_simple_rowgroup_ctr(j_decompress_ptr cinfo, JDIMENSION rows)
|
||||
{
|
||||
JDIMENSION rows_left;
|
||||
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
|
||||
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||
read_and_discard_scanlines(cinfo, rows);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Increment the counter to the next row group after the skipped rows. */
|
||||
main_ptr->rowgroup_ctr += rows / cinfo->max_v_samp_factor;
|
||||
@@ -382,21 +397,27 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
{
|
||||
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
JDIMENSION i, x;
|
||||
int y;
|
||||
JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row;
|
||||
JDIMENSION lines_to_skip, lines_to_read;
|
||||
|
||||
/* Two-pass color quantization is not supported. */
|
||||
if (cinfo->quantize_colors && cinfo->two_pass_quantize)
|
||||
ERREXIT(cinfo, JERR_NOTIMPL);
|
||||
|
||||
if (cinfo->global_state != DSTATE_SCANNING)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
/* Do not skip past the bottom of the image. */
|
||||
if (cinfo->output_scanline + num_lines >= cinfo->output_height) {
|
||||
num_lines = cinfo->output_height - cinfo->output_scanline;
|
||||
cinfo->output_scanline = cinfo->output_height;
|
||||
(*cinfo->inputctl->finish_input_pass) (cinfo);
|
||||
cinfo->inputctl->eoi_reached = TRUE;
|
||||
return cinfo->output_height - cinfo->output_scanline;
|
||||
return num_lines;
|
||||
}
|
||||
|
||||
if (num_lines == 0)
|
||||
@@ -445,8 +466,10 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
main_ptr->buffer_full = FALSE;
|
||||
main_ptr->rowgroup_ctr = 0;
|
||||
main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
if (!master->using_merged_upsample) {
|
||||
upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skipping is much simpler when context rows are not required. */
|
||||
@@ -458,8 +481,10 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->output_scanline += lines_left_in_iMCU_row;
|
||||
main_ptr->buffer_full = FALSE;
|
||||
main_ptr->rowgroup_ctr = 0;
|
||||
upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
if (!master->using_merged_upsample) {
|
||||
upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +519,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
|
||||
increment_simple_rowgroup_ctr(cinfo, lines_to_read);
|
||||
}
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
if (!master->using_merged_upsample)
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
return num_lines;
|
||||
}
|
||||
|
||||
@@ -535,7 +561,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
* bit odd, since "rows_to_go" seems to be redundantly keeping track of
|
||||
* output_scanline.
|
||||
*/
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
if (!master->using_merged_upsample)
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
|
||||
/* Always skip the requested number of lines. */
|
||||
return num_lines;
|
||||
|
||||
+1
-2
@@ -143,8 +143,7 @@ empty_mem_output_buffer(j_compress_ptr cinfo)
|
||||
|
||||
MEMCOPY(nextbuffer, dest->buffer, dest->bufsize);
|
||||
|
||||
if (dest->newbuffer != NULL)
|
||||
free(dest->newbuffer);
|
||||
free(dest->newbuffer);
|
||||
|
||||
dest->newbuffer = nextbuffer;
|
||||
|
||||
|
||||
+5
-3
@@ -6,7 +6,7 @@
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2010, 2015-2016, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* Copyright (C) 2015, 2020, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -495,11 +495,13 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
|
||||
if (first_row && block_row == 0)
|
||||
prev_block_row = buffer_ptr;
|
||||
else
|
||||
prev_block_row = buffer[block_row - 1];
|
||||
prev_block_row = buffer[block_row - 1] +
|
||||
cinfo->master->first_MCU_col[ci];
|
||||
if (last_row && block_row == block_rows - 1)
|
||||
next_block_row = buffer_ptr;
|
||||
else
|
||||
next_block_row = buffer[block_row + 1];
|
||||
next_block_row = buffer[block_row + 1] +
|
||||
cinfo->master->first_MCU_col[ci];
|
||||
/* We fetch the surrounding DC values using a sliding-register approach.
|
||||
* Initialize all nine here so as to do the right thing on narrow pics.
|
||||
*/
|
||||
|
||||
Vendored
+4
-5
@@ -571,11 +571,10 @@ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
* RGB565 conversion
|
||||
*/
|
||||
|
||||
#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
|
||||
(((g) << 3) & 0x7E0) | ((b) >> 3))
|
||||
#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
|
||||
(((g) << 11) & 0xE000) | \
|
||||
(((b) << 5) & 0x1F00))
|
||||
#define PACK_SHORT_565_LE(r, g, b) \
|
||||
((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
|
||||
#define PACK_SHORT_565_BE(r, g, b) \
|
||||
(((r) & 0xF8) | ((g) >> 5) | (((g) << 11) & 0xE000) | (((b) << 5) & 0x1F00))
|
||||
|
||||
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
|
||||
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
|
||||
|
||||
Vendored
+13
-42
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009, 2011, 2014-2015, D. R. Commander.
|
||||
* Copyright (C) 2009, 2011, 2014-2015, 2020, D. R. Commander.
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -40,41 +40,13 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jdmerge.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
|
||||
typedef struct {
|
||||
struct jpeg_upsampler pub; /* public fields */
|
||||
|
||||
/* Pointer to routine to do actual upsampling/conversion of one row group */
|
||||
void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
|
||||
|
||||
/* Private state for YCC->RGB conversion */
|
||||
int *Cr_r_tab; /* => table for Cr to R conversion */
|
||||
int *Cb_b_tab; /* => table for Cb to B conversion */
|
||||
JLONG *Cr_g_tab; /* => table for Cr to G conversion */
|
||||
JLONG *Cb_g_tab; /* => table for Cb to G conversion */
|
||||
|
||||
/* For 2:1 vertical sampling, we produce two output rows at a time.
|
||||
* We need a "spare" row buffer to hold the second output row if the
|
||||
* application provides just a one-row buffer; we also use the spare
|
||||
* to discard the dummy last row if the image height is odd.
|
||||
*/
|
||||
JSAMPROW spare_row;
|
||||
boolean spare_full; /* T if spare buffer is occupied */
|
||||
|
||||
JDIMENSION out_row_width; /* samples per output row */
|
||||
JDIMENSION rows_to_go; /* counts rows remaining in image */
|
||||
} my_upsampler;
|
||||
|
||||
typedef my_upsampler *my_upsample_ptr;
|
||||
|
||||
#define SCALEBITS 16 /* speediest right-shift on some machines */
|
||||
#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
|
||||
#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
|
||||
@@ -189,7 +161,7 @@ typedef my_upsampler *my_upsample_ptr;
|
||||
LOCAL(void)
|
||||
build_ycc_rgb_table(j_decompress_ptr cinfo)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
int i;
|
||||
JLONG x;
|
||||
SHIFT_TEMPS
|
||||
@@ -232,7 +204,7 @@ build_ycc_rgb_table(j_decompress_ptr cinfo)
|
||||
METHODDEF(void)
|
||||
start_pass_merged_upsample(j_decompress_ptr cinfo)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
|
||||
/* Mark the spare buffer empty */
|
||||
upsample->spare_full = FALSE;
|
||||
@@ -254,7 +226,7 @@ merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
|
||||
/* 2:1 vertical sampling case: may need a spare row. */
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
JSAMPROW work_ptrs[2];
|
||||
JDIMENSION num_rows; /* number of rows returned to caller */
|
||||
|
||||
@@ -305,7 +277,7 @@ merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
|
||||
/* 1:1 vertical sampling case: much easier, never need a spare row. */
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
|
||||
/* Just do the upsampling. */
|
||||
(*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
|
||||
@@ -420,11 +392,10 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
* RGB565 conversion
|
||||
*/
|
||||
|
||||
#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
|
||||
(((g) << 3) & 0x7E0) | ((b) >> 3))
|
||||
#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
|
||||
(((g) << 11) & 0xE000) | \
|
||||
(((b) << 5) & 0x1F00))
|
||||
#define PACK_SHORT_565_LE(r, g, b) \
|
||||
((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
|
||||
#define PACK_SHORT_565_BE(r, g, b) \
|
||||
(((r) & 0xF8) | ((g) >> 5) | (((g) << 11) & 0xE000) | (((b) << 5) & 0x1F00))
|
||||
|
||||
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
|
||||
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
|
||||
@@ -566,11 +537,11 @@ h2v2_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
GLOBAL(void)
|
||||
jinit_merged_upsampler(j_decompress_ptr cinfo)
|
||||
{
|
||||
my_upsample_ptr upsample;
|
||||
my_merged_upsample_ptr upsample;
|
||||
|
||||
upsample = (my_upsample_ptr)
|
||||
upsample = (my_merged_upsample_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
sizeof(my_upsampler));
|
||||
sizeof(my_merged_upsampler));
|
||||
cinfo->upsample = (struct jpeg_upsampler *)upsample;
|
||||
upsample->pub.start_pass = start_pass_merged_upsample;
|
||||
upsample->pub.need_context_rows = FALSE;
|
||||
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* jdmerge.h
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jpeglib.h"
|
||||
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
|
||||
typedef struct {
|
||||
struct jpeg_upsampler pub; /* public fields */
|
||||
|
||||
/* Pointer to routine to do actual upsampling/conversion of one row group */
|
||||
void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
|
||||
|
||||
/* Private state for YCC->RGB conversion */
|
||||
int *Cr_r_tab; /* => table for Cr to R conversion */
|
||||
int *Cb_b_tab; /* => table for Cb to B conversion */
|
||||
JLONG *Cr_g_tab; /* => table for Cr to G conversion */
|
||||
JLONG *Cb_g_tab; /* => table for Cb to G conversion */
|
||||
|
||||
/* For 2:1 vertical sampling, we produce two output rows at a time.
|
||||
* We need a "spare" row buffer to hold the second output row if the
|
||||
* application provides just a one-row buffer; we also use the spare
|
||||
* to discard the dummy last row if the image height is odd.
|
||||
*/
|
||||
JSAMPROW spare_row;
|
||||
boolean spare_full; /* T if spare buffer is occupied */
|
||||
|
||||
JDIMENSION out_row_width; /* samples per output row */
|
||||
JDIMENSION rows_to_go; /* counts rows remaining in image */
|
||||
} my_merged_upsampler;
|
||||
|
||||
typedef my_merged_upsampler *my_merged_upsample_ptr;
|
||||
|
||||
#endif /* UPSAMPLE_MERGING_SUPPORTED */
|
||||
+5
-5
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
* Copyright (C) 2014-2015, 2018, D. R. Commander.
|
||||
* Copyright (C) 2014-2015, 2018, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -19,7 +19,7 @@ h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr;
|
||||
@@ -90,7 +90,7 @@ h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr;
|
||||
@@ -163,7 +163,7 @@ h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr0, outptr1;
|
||||
@@ -259,7 +259,7 @@ h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr0, outptr1;
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2011, 2015, D. R. Commander.
|
||||
* Copyright (C) 2011, 2015, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -25,7 +25,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr;
|
||||
@@ -97,7 +97,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr0, outptr1;
|
||||
|
||||
Vendored
+3
-2
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1995-1997, Thomas G. Lane.
|
||||
* It was modified by The libjpeg-turbo Project to include only code relevant
|
||||
* to libjpeg-turbo.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -16,6 +16,7 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jpegcomp.h"
|
||||
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2015, D. R. Commander.
|
||||
* Copyright (C) 2015, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
* This file contains a slow-but-accurate integer implementation of the
|
||||
* This file contains a slower but more accurate integer implementation of the
|
||||
* forward DCT (Discrete Cosine Transform).
|
||||
*
|
||||
* A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
|
||||
|
||||
+2
-2
@@ -5,11 +5,11 @@
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modification developed 2002-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2015, D. R. Commander.
|
||||
* Copyright (C) 2015, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
* This file contains a slow-but-accurate integer implementation of the
|
||||
* This file contains a slower but more accurate integer implementation of the
|
||||
* inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
|
||||
* must also perform dequantization of the input coefficients.
|
||||
*
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009, 2011, 2014-2015, 2018, D. R. Commander.
|
||||
* Copyright (C) 2009, 2011, 2014-2015, 2018, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -273,9 +273,9 @@ typedef int boolean;
|
||||
|
||||
/* Capability options common to encoder and decoder: */
|
||||
|
||||
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
||||
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
|
||||
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
|
||||
#define DCT_ISLOW_SUPPORTED /* accurate integer method */
|
||||
#define DCT_IFAST_SUPPORTED /* less accurate int method [legacy feature] */
|
||||
#define DCT_FLOAT_SUPPORTED /* floating-point method [legacy feature] */
|
||||
|
||||
/* Encoder capability options: */
|
||||
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jpegcomp.h
|
||||
*
|
||||
* Copyright (C) 2010, D. R. Commander.
|
||||
* Copyright (C) 2010, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -19,6 +19,7 @@
|
||||
#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
|
||||
#define _jpeg_width jpeg_width
|
||||
#define _jpeg_height jpeg_height
|
||||
#define JERR_ARITH_NOTIMPL JERR_NOT_COMPILED
|
||||
#else
|
||||
#define _DCT_scaled_size DCT_scaled_size
|
||||
#define _DCT_h_scaled_size DCT_scaled_size
|
||||
|
||||
Vendored
+4
-4
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016-2017, D. R. Commander.
|
||||
* Copyright (C) 2009-2011, 2013-2014, 2016-2017, 2020, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -244,9 +244,9 @@ typedef enum {
|
||||
/* DCT/IDCT algorithm options. */
|
||||
|
||||
typedef enum {
|
||||
JDCT_ISLOW, /* slow but accurate integer algorithm */
|
||||
JDCT_IFAST, /* faster, less accurate integer method */
|
||||
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
|
||||
JDCT_ISLOW, /* accurate integer method */
|
||||
JDCT_IFAST, /* less accurate integer method [legacy feature] */
|
||||
JDCT_FLOAT /* floating-point method [legacy feature] */
|
||||
} J_DCT_METHOD;
|
||||
|
||||
#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */
|
||||
|
||||
Vendored
+3
-3
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2009, 2014-2015, D. R. Commander.
|
||||
* Copyright (C) 2009, 2014-2015, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -1145,7 +1145,7 @@ start_pass_2_quant(j_decompress_ptr cinfo, boolean is_pre_scan)
|
||||
int i;
|
||||
|
||||
/* Only F-S dithering or no dithering is supported. */
|
||||
/* If user asks for ordered dither, give him F-S. */
|
||||
/* If user asks for ordered dither, give them F-S. */
|
||||
if (cinfo->dither_mode != JDITHER_NONE)
|
||||
cinfo->dither_mode = JDITHER_FS;
|
||||
|
||||
@@ -1263,7 +1263,7 @@ jinit_2pass_quantizer(j_decompress_ptr cinfo)
|
||||
cquantize->sv_colormap = NULL;
|
||||
|
||||
/* Only F-S dithering or no dithering is supported. */
|
||||
/* If user asks for ordered dither, give him F-S. */
|
||||
/* If user asks for ordered dither, give them F-S. */
|
||||
if (cinfo->dither_mode != JDITHER_NONE)
|
||||
cinfo->dither_mode = JDITHER_FS;
|
||||
|
||||
|
||||
+11
-9
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2010, 2012-2019, D. R. Commander.
|
||||
* Copyright (C) 2010, 2012-2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -30,23 +30,25 @@
|
||||
* NOTE: It is our convention to place the authors in the following order:
|
||||
* - libjpeg-turbo authors (2009-) in descending order of the date of their
|
||||
* most recent contribution to the project, then in ascending order of the
|
||||
* date of their first contribution to the project
|
||||
* date of their first contribution to the project, then in alphabetical
|
||||
* order
|
||||
* - Upstream authors in descending order of the date of the first inclusion of
|
||||
* their code
|
||||
*/
|
||||
|
||||
#define JCOPYRIGHT \
|
||||
"Copyright (C) 2009-2019 D. R. Commander\n" \
|
||||
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
|
||||
"Copyright (C) 2009-2020 D. R. Commander\n" \
|
||||
"Copyright (C) 2015, 2020 Google, Inc.\n" \
|
||||
"Copyright (C) 2019 Arm Limited\n" \
|
||||
"Copyright (C) 2015-2016, 2018 Matthieu Darbois\n" \
|
||||
"Copyright (C) 2011-2016 Siarhei Siamashka\n" \
|
||||
"Copyright (C) 2015 Intel Corporation\n" \
|
||||
"Copyright (C) 2015 Google, Inc.\n" \
|
||||
"Copyright (C) 2013-2014 Linaro Limited\n" \
|
||||
"Copyright (C) 2013-2014 MIPS Technologies, Inc.\n" \
|
||||
"Copyright (C) 2013 Linaro Limited\n" \
|
||||
"Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB\n" \
|
||||
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)\n" \
|
||||
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
|
||||
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
|
||||
"Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding"
|
||||
"Copyright (C) 1991-2017 Thomas G. Lane, Guido Vollbeding"
|
||||
|
||||
#define JCOPYRIGHT_SHORT \
|
||||
"Copyright (C) 1991-2019 The libjpeg-turbo Project and many others"
|
||||
"Copyright (C) 1991-2020 The libjpeg-turbo Project and many others"
|
||||
|
||||
Vendored
+2
-2
@@ -19,7 +19,7 @@ endif()
|
||||
# Define the library target:
|
||||
# ----------------------------------------------------------------------------------
|
||||
|
||||
add_library(${JPEG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
||||
add_library(${JPEG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs})
|
||||
|
||||
if(CV_GCC OR CV_CLANG)
|
||||
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
|
||||
@@ -42,7 +42,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${JPEG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(libjpeg README)
|
||||
|
||||
Vendored
+6
-13
@@ -1,7 +1,7 @@
|
||||
The Independent JPEG Group's JPEG software
|
||||
==========================================
|
||||
|
||||
README for release 9c of 14-Jan-2018
|
||||
README for release 9d of 12-Jan-2020
|
||||
====================================
|
||||
|
||||
This distribution contains the ninth public release of the Independent JPEG
|
||||
@@ -10,8 +10,8 @@ to use it for any purpose, subject to the conditions under LEGAL ISSUES, below.
|
||||
|
||||
This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone,
|
||||
Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson,
|
||||
Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
|
||||
and other members of the Independent JPEG Group.
|
||||
John Korejwa, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi,
|
||||
Ge' Weijers, and other members of the Independent JPEG Group.
|
||||
|
||||
IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
|
||||
(previously known as JPEG, together with ITU-T SG16).
|
||||
@@ -115,7 +115,7 @@ with respect to this software, its quality, accuracy, merchantability, or
|
||||
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
||||
This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
@@ -152,13 +152,6 @@ The same holds for its supporting scripts (config.guess, config.sub,
|
||||
ltmain.sh). Another support script, install-sh, is copyright by X Consortium
|
||||
but is also freely distributable.
|
||||
|
||||
The IJG distribution formerly included code to read and write GIF files.
|
||||
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
|
||||
support has been removed altogether, and the GIF writer has been simplified
|
||||
to produce "uncompressed GIFs". This technique does not use the LZW
|
||||
algorithm; the resulting GIF files are larger than usual, but are readable
|
||||
by all standard GIF decoders.
|
||||
|
||||
|
||||
REFERENCES
|
||||
==========
|
||||
@@ -246,8 +239,8 @@ ARCHIVE LOCATIONS
|
||||
The "official" archive site for this software is www.ijg.org.
|
||||
The most recent released version can always be found there in
|
||||
directory "files". This particular version will be archived as
|
||||
http://www.ijg.org/files/jpegsrc.v9c.tar.gz, and in Windows-compatible
|
||||
"zip" archive format as http://www.ijg.org/files/jpegsr9c.zip.
|
||||
http://www.ijg.org/files/jpegsrc.v9d.tar.gz, and in Windows-compatible
|
||||
"zip" archive format as http://www.ijg.org/files/jpegsr9d.zip.
|
||||
|
||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||
general information about JPEG.
|
||||
|
||||
Vendored
+49
@@ -1,6 +1,55 @@
|
||||
CHANGE LOG for Independent JPEG Group's JPEG software
|
||||
|
||||
|
||||
Version 9d 12-Jan-2020
|
||||
-----------------------
|
||||
|
||||
Optimize the optimal Huffman code table generation to produce
|
||||
slightly smaller files. Thank to John Korejwa for suggestion.
|
||||
Note: Requires rebuild of testimgp.jpg.
|
||||
|
||||
Decoding Huffman: Use default tables if tables are not defined.
|
||||
Thank to Simone Azzalin for report (Motion JPEG),
|
||||
and to Martin Strunz for hint.
|
||||
|
||||
Add sanity check in optimal Huffman code table generation.
|
||||
Thank to Adam Farley for suggestion.
|
||||
|
||||
rdtarga.c: use read_byte(), with EOF check, instead of getc()
|
||||
in read_*_pixel().
|
||||
Thank to Chijin Zhou for cjpeg potential vulnerability report.
|
||||
|
||||
jmemnobs.c: respect the max_memory_to_use setting in
|
||||
jpeg_mem_available() computation. Thank to Sheng Shu and
|
||||
Dongdong She for djpeg potential vulnerability report.
|
||||
|
||||
jdarith.c, jdhuff.c: avoid left shift of negative value
|
||||
compiler warning in decode_mcu_AC_refine().
|
||||
Thank to Indu Bhagat for suggestion.
|
||||
|
||||
Add x64 (64-bit) platform support, avoid compiler warnings.
|
||||
Thank to Jonathan Potter, Feiyun Wang, and Sheng Shu for suggestion.
|
||||
|
||||
Adjust libjpeg version specification for pkg-config file.
|
||||
Thank to Chen Chen for suggestion.
|
||||
|
||||
Restore GIF read and write support from libjpeg version 6a.
|
||||
Thank to Wolfgang Werner (W.W.) Heinz for suggestion.
|
||||
|
||||
Improve consistency in raw (downsampled) image data processing mode.
|
||||
Thank to Zhongyuan Zhou for hint.
|
||||
|
||||
Avoid out of bounds array read (AC derived table pointers)
|
||||
in start pass in jdhuff.c. Thank to Peng Li for report.
|
||||
|
||||
Improve code sanity (jdhuff.c).
|
||||
Thank to Reza Mirzazade farkhani for reports.
|
||||
|
||||
Add jpegtran -drop option; add options to the crop extension and wipe
|
||||
to fill the extra area with content from the source image region,
|
||||
instead of gray out.
|
||||
|
||||
|
||||
Version 9c 14-Jan-2018
|
||||
-----------------------
|
||||
|
||||
|
||||
Vendored
+9
-8
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jcarith.c
|
||||
*
|
||||
* Developed 1997-2013 by Guido Vollbeding.
|
||||
* Developed 1997-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -181,11 +181,11 @@ finish_pass (j_compress_ptr cinfo)
|
||||
if (e->zc) /* output final pending zero bytes */
|
||||
do emit_byte(0x00, cinfo);
|
||||
while (--e->zc);
|
||||
emit_byte((e->c >> 19) & 0xFF, cinfo);
|
||||
emit_byte((int) ((e->c >> 19) & 0xFF), cinfo);
|
||||
if (((e->c >> 19) & 0xFF) == 0xFF)
|
||||
emit_byte(0x00, cinfo);
|
||||
if (e->c & 0x7F800L) {
|
||||
emit_byte((e->c >> 11) & 0xFF, cinfo);
|
||||
emit_byte((int) ((e->c >> 11) & 0xFF), cinfo);
|
||||
if (((e->c >> 11) & 0xFF) == 0xFF)
|
||||
emit_byte(0x00, cinfo);
|
||||
}
|
||||
@@ -280,7 +280,8 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
|
||||
/* Note: The 3 spacer bits in the C register guarantee
|
||||
* that the new buffer byte can't be 0xFF here
|
||||
* (see page 160 in the P&M JPEG book). */
|
||||
e->buffer = temp & 0xFF; /* new output byte, might overflow later */
|
||||
/* New output byte, might overflow later */
|
||||
e->buffer = (int) (temp & 0xFF);
|
||||
} else if (temp == 0xFF) {
|
||||
++e->sc; /* stack 0xFF byte (which might overflow later) */
|
||||
} else {
|
||||
@@ -302,7 +303,8 @@ arith_encode (j_compress_ptr cinfo, unsigned char *st, int val)
|
||||
emit_byte(0x00, cinfo);
|
||||
} while (--e->sc);
|
||||
}
|
||||
e->buffer = temp & 0xFF; /* new output byte (can still overflow) */
|
||||
/* New output byte (can still overflow) */
|
||||
e->buffer = (int) (temp & 0xFF);
|
||||
}
|
||||
e->c &= 0x7FFFFL;
|
||||
e->ct += 8;
|
||||
@@ -926,9 +928,8 @@ jinit_arith_encoder (j_compress_ptr cinfo)
|
||||
arith_entropy_ptr entropy;
|
||||
int i;
|
||||
|
||||
entropy = (arith_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(arith_entropy_encoder));
|
||||
entropy = (arith_entropy_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(arith_entropy_encoder));
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass;
|
||||
entropy->pub.finish_pass = finish_pass;
|
||||
|
||||
Vendored
+47
-50
@@ -2,7 +2,7 @@
|
||||
* jccolor.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modified 2011-2013 by Guido Vollbeding.
|
||||
* Modified 2011-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -105,14 +105,14 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
||||
/* Allocate and fill in the conversion tables. */
|
||||
cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(TABLE_SIZE * SIZEOF(INT32)));
|
||||
TABLE_SIZE * SIZEOF(INT32));
|
||||
|
||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||
rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i;
|
||||
rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i;
|
||||
rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF;
|
||||
rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.168735892)) * i;
|
||||
rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.331264108)) * i;
|
||||
rgb_ycc_tab[i+R_CB_OFF] = (- FIX(0.168735892)) * i;
|
||||
rgb_ycc_tab[i+G_CB_OFF] = (- FIX(0.331264108)) * i;
|
||||
/* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
|
||||
* This ensures that the maximum output will round to MAXJSAMPLE
|
||||
* not MAXJSAMPLE+1, and thus that we don't have to range-limit.
|
||||
@@ -121,8 +121,8 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
||||
/* B=>Cb and R=>Cr tables are the same
|
||||
rgb_ycc_tab[i+R_CR_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1;
|
||||
*/
|
||||
rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.418687589)) * i;
|
||||
rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.081312411)) * i;
|
||||
rgb_ycc_tab[i+G_CR_OFF] = (- FIX(0.418687589)) * i;
|
||||
rgb_ycc_tab[i+B_CR_OFF] = (- FIX(0.081312411)) * i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,12 +131,12 @@ rgb_ycc_start (j_compress_ptr cinfo)
|
||||
* Convert some rows of samples to the JPEG colorspace.
|
||||
*
|
||||
* Note that we change from the application's interleaved-pixel format
|
||||
* to our internal noninterleaved, one-plane-per-component format.
|
||||
* The input buffer is therefore three times as wide as the output buffer.
|
||||
* to our internal noninterleaved, one-plane-per-component format. The
|
||||
* input buffer is therefore three times as wide as the output buffer.
|
||||
*
|
||||
* A starting row offset is provided only for the output buffer. The caller
|
||||
* can easily adjust the passed input_buf value to accommodate any row
|
||||
* offset required on that side.
|
||||
* A starting row offset is provided only for the output buffer. The
|
||||
* caller can easily adjust the passed input_buf value to accommodate
|
||||
* any row offset required on that side.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
@@ -145,8 +145,8 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr0, outptr1, outptr2;
|
||||
register JDIMENSION col;
|
||||
@@ -162,6 +162,7 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
* Hence the value being shifted is never negative, and we don't
|
||||
@@ -179,7 +180,6 @@ rgb_ycc_convert (j_compress_ptr cinfo,
|
||||
outptr2[col] = (JSAMPLE)
|
||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
||||
>> SCALEBITS);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,8 +201,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr;
|
||||
register JDIMENSION col;
|
||||
@@ -215,11 +215,11 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)
|
||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||
>> SCALEBITS);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,8 +228,8 @@ rgb_gray_convert (j_compress_ptr cinfo,
|
||||
/*
|
||||
* Convert some rows of samples to the JPEG colorspace.
|
||||
* This version handles Adobe-style CMYK->YCCK conversion,
|
||||
* where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same
|
||||
* conversion as above, while passing K (black) unchanged.
|
||||
* where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the
|
||||
* same conversion as above, while passing K (black) unchanged.
|
||||
* We assume rgb_ycc_start has been called.
|
||||
*/
|
||||
|
||||
@@ -239,8 +239,8 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_ycc_tab;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr0, outptr1, outptr2, outptr3;
|
||||
register JDIMENSION col;
|
||||
@@ -259,6 +259,7 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
|
||||
/* K passes through as-is */
|
||||
outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
|
||||
inptr += 4;
|
||||
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
|
||||
* must be too; we do not need an explicit range-limiting operation.
|
||||
* Hence the value being shifted is never negative, and we don't
|
||||
@@ -276,7 +277,6 @@ cmyk_ycck_convert (j_compress_ptr cinfo,
|
||||
outptr2[col] = (JSAMPLE)
|
||||
((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
|
||||
>> SCALEBITS);
|
||||
inptr += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,13 +312,13 @@ rgb_rgb1_convert (j_compress_ptr cinfo,
|
||||
r = GETJSAMPLE(inptr[RGB_RED]);
|
||||
g = GETJSAMPLE(inptr[RGB_GREEN]);
|
||||
b = GETJSAMPLE(inptr[RGB_BLUE]);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
/* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD
|
||||
* (modulo) operator is equivalent to the bitmask operator AND.
|
||||
*/
|
||||
outptr0[col] = (JSAMPLE) ((r - g + CENTERJSAMPLE) & MAXJSAMPLE);
|
||||
outptr1[col] = (JSAMPLE) g;
|
||||
outptr2[col] = (JSAMPLE) ((b - g + CENTERJSAMPLE) & MAXJSAMPLE);
|
||||
inptr += RGB_PIXELSIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,17 +335,17 @@ grayscale_convert (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
int instride = cinfo->input_components;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr;
|
||||
register JDIMENSION col;
|
||||
register JDIMENSION count;
|
||||
register int instride = cinfo->input_components;
|
||||
JDIMENSION num_cols = cinfo->image_width;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
inptr = *input_buf++;
|
||||
outptr = output_buf[0][output_row++];
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */
|
||||
for (count = num_cols; count > 0; count--) {
|
||||
*outptr++ = *inptr; /* don't need GETJSAMPLE() here */
|
||||
inptr += instride;
|
||||
}
|
||||
}
|
||||
@@ -396,21 +396,21 @@ null_convert (j_compress_ptr cinfo,
|
||||
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
|
||||
JDIMENSION output_row, int num_rows)
|
||||
{
|
||||
int ci;
|
||||
register int nc = cinfo->num_components;
|
||||
register JSAMPROW inptr;
|
||||
register JSAMPROW outptr;
|
||||
register JDIMENSION col;
|
||||
register JDIMENSION count;
|
||||
register int num_comps = cinfo->num_components;
|
||||
JDIMENSION num_cols = cinfo->image_width;
|
||||
int ci;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
/* It seems fastest to make a separate pass for each component. */
|
||||
for (ci = 0; ci < nc; ci++) {
|
||||
for (ci = 0; ci < num_comps; ci++) {
|
||||
inptr = input_buf[0] + ci;
|
||||
outptr = output_buf[ci][output_row];
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
for (count = num_cols; count > 0; count--) {
|
||||
*outptr++ = *inptr; /* don't need GETJSAMPLE() here */
|
||||
inptr += nc;
|
||||
inptr += num_comps;
|
||||
}
|
||||
}
|
||||
input_buf++;
|
||||
@@ -439,9 +439,8 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
{
|
||||
my_cconvert_ptr cconvert;
|
||||
|
||||
cconvert = (my_cconvert_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_color_converter));
|
||||
cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_color_converter));
|
||||
cinfo->cconvert = &cconvert->pub;
|
||||
/* set start_pass to null method until we find out differently */
|
||||
cconvert->pub.start_pass = null_method;
|
||||
@@ -455,9 +454,11 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
|
||||
case JCS_RGB:
|
||||
case JCS_BG_RGB:
|
||||
#if RGB_PIXELSIZE != 3
|
||||
if (cinfo->input_components != RGB_PIXELSIZE)
|
||||
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
break;
|
||||
#endif /* else share code with YCbCr */
|
||||
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_YCC:
|
||||
@@ -474,7 +475,6 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
default: /* JCS_UNKNOWN can be anything */
|
||||
if (cinfo->input_components < 1)
|
||||
ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Support color transform only for RGB colorspaces */
|
||||
@@ -507,19 +507,18 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
case JCS_BG_RGB:
|
||||
if (cinfo->num_components != 3)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == cinfo->jpeg_color_space) {
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb_rgb1_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
} else
|
||||
if (cinfo->in_color_space != cinfo->jpeg_color_space)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb_rgb1_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
break;
|
||||
|
||||
case JCS_YCbCr:
|
||||
@@ -572,10 +571,9 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
case JCS_CMYK:
|
||||
if (cinfo->num_components != 4)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
if (cinfo->in_color_space == JCS_CMYK)
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
else
|
||||
if (cinfo->in_color_space != JCS_CMYK)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
break;
|
||||
|
||||
case JCS_YCCK:
|
||||
@@ -599,6 +597,5 @@ jinit_color_converter (j_compress_ptr cinfo)
|
||||
cinfo->num_components != cinfo->input_components)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+109
-42
@@ -2,7 +2,7 @@
|
||||
* jchuff.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2006-2013 by Guido Vollbeding.
|
||||
* Modified 2006-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -178,13 +178,12 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
|
||||
htbl =
|
||||
isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
|
||||
if (htbl == NULL)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
|
||||
htbl = jpeg_std_huff_table((j_common_ptr) cinfo, isDC, tblno);
|
||||
|
||||
/* Allocate a workspace if we haven't already done so. */
|
||||
if (*pdtbl == NULL)
|
||||
*pdtbl = (c_derived_tbl *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(c_derived_tbl));
|
||||
*pdtbl = (c_derived_tbl *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(c_derived_tbl));
|
||||
dtbl = *pdtbl;
|
||||
|
||||
/* Figure C.1: make table of Huffman code length for each symbol */
|
||||
@@ -1256,22 +1255,88 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
||||
UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
|
||||
int codesize[257]; /* codesize[k] = code length of symbol k */
|
||||
int others[257]; /* next symbol in current branch of tree */
|
||||
int c1, c2;
|
||||
int p, i, j;
|
||||
int c1, c2, i, j;
|
||||
UINT8 *p;
|
||||
long v;
|
||||
|
||||
freq[256] = 1; /* make sure 256 has a nonzero count */
|
||||
/* Including the pseudo-symbol 256 in the Huffman procedure guarantees
|
||||
* that no real symbol is given code-value of all ones, because 256
|
||||
* will be placed last in the largest codeword category.
|
||||
* In the symbol list build procedure this element serves as sentinel
|
||||
* for the zero run loop.
|
||||
*/
|
||||
|
||||
#ifndef DONT_USE_FANCY_HUFF_OPT
|
||||
|
||||
/* Build list of symbols sorted in order of descending frequency */
|
||||
/* This approach has several benefits (thank to John Korejwa for the idea):
|
||||
* 1.
|
||||
* If a codelength category is split during the length limiting procedure
|
||||
* below, the feature that more frequent symbols are assigned shorter
|
||||
* codewords remains valid for the adjusted code.
|
||||
* 2.
|
||||
* To reduce consecutive ones in a Huffman data stream (thus reducing the
|
||||
* number of stuff bytes in JPEG) it is preferable to follow 0 branches
|
||||
* (and avoid 1 branches) as much as possible. This is easily done by
|
||||
* assigning symbols to leaves of the Huffman tree in order of decreasing
|
||||
* frequency, with no secondary sort based on codelengths.
|
||||
* 3.
|
||||
* The symbol list can be built independently from the assignment of code
|
||||
* lengths by the Huffman procedure below.
|
||||
* Note: The symbol list build procedure must be performed first, because
|
||||
* the Huffman procedure assigning the codelengths clobbers the frequency
|
||||
* counts!
|
||||
*/
|
||||
|
||||
/* Here we use the others array as a linked list of nonzero frequencies
|
||||
* to be sorted. Already sorted elements are removed from the list.
|
||||
*/
|
||||
|
||||
/* Building list */
|
||||
|
||||
/* This item does not correspond to a valid symbol frequency and is used
|
||||
* as starting index.
|
||||
*/
|
||||
j = 256;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
if (freq[i] == 0) /* skip zero frequencies */
|
||||
continue;
|
||||
if (i > 255)
|
||||
break;
|
||||
others[j] = i; /* this symbol value */
|
||||
j = i; /* previous symbol value */
|
||||
}
|
||||
others[j] = -1; /* mark end of list */
|
||||
|
||||
/* Sorting list */
|
||||
|
||||
p = htbl->huffval;
|
||||
while ((c1 = others[256]) >= 0) {
|
||||
v = freq[c1];
|
||||
i = c1; /* first symbol value */
|
||||
j = 256; /* pseudo symbol value for starting index */
|
||||
while ((c2 = others[c1]) >= 0) {
|
||||
if (freq[c2] > v) {
|
||||
v = freq[c2];
|
||||
i = c2; /* this symbol value */
|
||||
j = c1; /* previous symbol value */
|
||||
}
|
||||
c1 = c2;
|
||||
}
|
||||
others[j] = others[i]; /* remove this symbol i from list */
|
||||
*p++ = (UINT8) i;
|
||||
}
|
||||
|
||||
#endif /* DONT_USE_FANCY_HUFF_OPT */
|
||||
|
||||
/* This algorithm is explained in section K.2 of the JPEG standard */
|
||||
|
||||
MEMZERO(bits, SIZEOF(bits));
|
||||
MEMZERO(codesize, SIZEOF(codesize));
|
||||
for (i = 0; i < 257; i++)
|
||||
others[i] = -1; /* init links to empty */
|
||||
|
||||
freq[256] = 1; /* make sure 256 has a nonzero count */
|
||||
/* Including the pseudo-symbol 256 in the Huffman procedure guarantees
|
||||
* that no real symbol is given code-value of all ones, because 256
|
||||
* will be placed last in the largest codeword category.
|
||||
*/
|
||||
|
||||
/* Huffman's basic algorithm to assign optimal code lengths to symbols */
|
||||
|
||||
@@ -1301,7 +1366,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
||||
/* Done if we've merged everything into one frequency */
|
||||
if (c2 < 0)
|
||||
break;
|
||||
|
||||
|
||||
/* Else merge the two counts/trees */
|
||||
freq[c1] += freq[c2];
|
||||
freq[c2] = 0;
|
||||
@@ -1312,9 +1377,9 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
||||
c1 = others[c1];
|
||||
codesize[c1]++;
|
||||
}
|
||||
|
||||
|
||||
others[c1] = c2; /* chain c2 onto c1's tree branch */
|
||||
|
||||
|
||||
/* Increment the codesize of everything in c2's tree branch */
|
||||
codesize[c2]++;
|
||||
while (others[c2] >= 0) {
|
||||
@@ -1329,7 +1394,7 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
||||
/* The JPEG standard seems to think that this can't happen, */
|
||||
/* but I'm paranoid... */
|
||||
if (codesize[i] > MAX_CLEN)
|
||||
ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
|
||||
ERREXIT(cinfo, JERR_HUFF_CLEN_OUTOFBOUNDS);
|
||||
|
||||
bits[codesize[i]]++;
|
||||
}
|
||||
@@ -1345,13 +1410,16 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
||||
* shortest nonzero BITS entry is converted into a prefix for two code words
|
||||
* one bit longer.
|
||||
*/
|
||||
|
||||
|
||||
for (i = MAX_CLEN; i > 16; i--) {
|
||||
while (bits[i] > 0) {
|
||||
j = i - 2; /* find length of new prefix to be used */
|
||||
while (bits[j] == 0)
|
||||
while (bits[j] == 0) {
|
||||
if (j == 0)
|
||||
ERREXIT(cinfo, JERR_HUFF_CLEN_OUTOFBOUNDS);
|
||||
j--;
|
||||
|
||||
}
|
||||
|
||||
bits[i] -= 2; /* remove two symbols */
|
||||
bits[i-1]++; /* one goes in this length */
|
||||
bits[j+1] += 2; /* two new symbols in this length */
|
||||
@@ -1363,24 +1431,27 @@ jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
|
||||
while (bits[i] == 0) /* find largest codelength still in use */
|
||||
i--;
|
||||
bits[i]--;
|
||||
|
||||
|
||||
/* Return final symbol counts (only for lengths 0..16) */
|
||||
MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
|
||||
|
||||
|
||||
#ifdef DONT_USE_FANCY_HUFF_OPT
|
||||
|
||||
/* Return a list of the symbols sorted by code length */
|
||||
/* It's not real clear to me why we don't need to consider the codelength
|
||||
* changes made above, but the JPEG spec seems to think this works.
|
||||
/* Note: Due to the codelength changes made above, it can happen
|
||||
* that more frequent symbols are assigned longer codewords.
|
||||
*/
|
||||
p = 0;
|
||||
p = htbl->huffval;
|
||||
for (i = 1; i <= MAX_CLEN; i++) {
|
||||
for (j = 0; j <= 255; j++) {
|
||||
if (codesize[j] == i) {
|
||||
htbl->huffval[p] = (UINT8) j;
|
||||
p++;
|
||||
*p++ = (UINT8) j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* DONT_USE_FANCY_HUFF_OPT */
|
||||
|
||||
/* Set sent_table FALSE so updated table will be written to JPEG file. */
|
||||
htbl->sent_table = FALSE;
|
||||
}
|
||||
@@ -1400,13 +1471,13 @@ finish_pass_gather (j_compress_ptr cinfo)
|
||||
boolean did_dc[NUM_HUFF_TBLS];
|
||||
boolean did_ac[NUM_HUFF_TBLS];
|
||||
|
||||
/* It's important not to apply jpeg_gen_optimal_table more than once
|
||||
* per table, because it clobbers the input frequency counts!
|
||||
*/
|
||||
if (cinfo->progressive_mode)
|
||||
/* Flush out buffered data (all we care about is counting the EOB symbol) */
|
||||
emit_eobrun(entropy);
|
||||
|
||||
/* It's important not to apply jpeg_gen_optimal_table more than once
|
||||
* per table, because it clobbers the input frequency counts!
|
||||
*/
|
||||
MEMZERO(did_dc, SIZEOF(did_dc));
|
||||
MEMZERO(did_ac, SIZEOF(did_ac));
|
||||
|
||||
@@ -1475,9 +1546,8 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
entropy->pub.encode_mcu = encode_mcu_AC_refine;
|
||||
/* AC refinement needs a correction bit buffer */
|
||||
if (entropy->bit_buffer == NULL)
|
||||
entropy->bit_buffer = (char *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
MAX_CORR_BITS * SIZEOF(char));
|
||||
entropy->bit_buffer = (char *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, MAX_CORR_BITS * SIZEOF(char));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1505,9 +1575,8 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
/* Allocate and zero the statistics tables */
|
||||
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
|
||||
if (entropy->dc_count_ptrs[tbl] == NULL)
|
||||
entropy->dc_count_ptrs[tbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * SIZEOF(long));
|
||||
entropy->dc_count_ptrs[tbl] = (long *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, 257 * SIZEOF(long));
|
||||
MEMZERO(entropy->dc_count_ptrs[tbl], 257 * SIZEOF(long));
|
||||
} else {
|
||||
/* Compute derived values for Huffman tables */
|
||||
@@ -1525,9 +1594,8 @@ start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
|
||||
if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
|
||||
if (entropy->ac_count_ptrs[tbl] == NULL)
|
||||
entropy->ac_count_ptrs[tbl] = (long *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
257 * SIZEOF(long));
|
||||
entropy->ac_count_ptrs[tbl] = (long *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, 257 * SIZEOF(long));
|
||||
MEMZERO(entropy->ac_count_ptrs[tbl], 257 * SIZEOF(long));
|
||||
} else {
|
||||
jpeg_make_c_derived_tbl(cinfo, FALSE, tbl,
|
||||
@@ -1556,9 +1624,8 @@ jinit_huff_encoder (j_compress_ptr cinfo)
|
||||
huff_entropy_ptr entropy;
|
||||
int i;
|
||||
|
||||
entropy = (huff_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(huff_entropy_encoder));
|
||||
entropy = (huff_entropy_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(huff_entropy_encoder));
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass_huff;
|
||||
|
||||
|
||||
Vendored
+3
-5
@@ -2,7 +2,7 @@
|
||||
* jcmarker.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* Modified 2003-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -471,7 +471,6 @@ emit_adobe_app14 (j_compress_ptr cinfo)
|
||||
break;
|
||||
default:
|
||||
emit_byte(cinfo, 0); /* Color transform = 0 */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,9 +701,8 @@ jinit_marker_writer (j_compress_ptr cinfo)
|
||||
my_marker_ptr marker;
|
||||
|
||||
/* Create the subobject */
|
||||
marker = (my_marker_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_marker_writer));
|
||||
marker = (my_marker_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_marker_writer));
|
||||
cinfo->marker = &marker->pub;
|
||||
/* Initialize method pointers */
|
||||
marker->pub.write_file_header = write_file_header;
|
||||
|
||||
Vendored
+18
-15
@@ -2,7 +2,7 @@
|
||||
* jcmaster.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2003-2017 by Guido Vollbeding.
|
||||
* Modified 2003-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -62,7 +62,7 @@ initial_setup (j_compress_ptr cinfo)
|
||||
case 5: cinfo->natural_order = jpeg_natural_order5; break;
|
||||
case 6: cinfo->natural_order = jpeg_natural_order6; break;
|
||||
case 7: cinfo->natural_order = jpeg_natural_order7; break;
|
||||
default: cinfo->natural_order = jpeg_natural_order; break;
|
||||
default: cinfo->natural_order = jpeg_natural_order;
|
||||
}
|
||||
|
||||
/* Derive lim_Se from block_size */
|
||||
@@ -114,20 +114,24 @@ initial_setup (j_compress_ptr cinfo)
|
||||
*/
|
||||
ssize = 1;
|
||||
#ifdef DCT_SCALING_SUPPORTED
|
||||
while (cinfo->min_DCT_h_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) == 0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
if (! cinfo->raw_data_in)
|
||||
while (cinfo->min_DCT_h_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) ==
|
||||
0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
#endif
|
||||
compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size * ssize;
|
||||
ssize = 1;
|
||||
#ifdef DCT_SCALING_SUPPORTED
|
||||
while (cinfo->min_DCT_v_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) == 0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
if (! cinfo->raw_data_in)
|
||||
while (cinfo->min_DCT_v_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) ==
|
||||
0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
#endif
|
||||
compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size * ssize;
|
||||
|
||||
@@ -620,9 +624,8 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
||||
{
|
||||
my_master_ptr master;
|
||||
|
||||
master = (my_master_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_comp_master));
|
||||
master = (my_master_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_comp_master));
|
||||
cinfo->master = &master->pub;
|
||||
master->pub.prepare_for_pass = prepare_for_pass;
|
||||
master->pub.pass_startup = pass_startup;
|
||||
|
||||
Vendored
+138
@@ -2,6 +2,7 @@
|
||||
* jcomapi.c
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -104,3 +105,140 @@ jpeg_alloc_huff_table (j_common_ptr cinfo)
|
||||
tbl->sent_table = FALSE; /* make sure this is false in any new table */
|
||||
return tbl;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set up the standard Huffman tables (cf. JPEG standard section K.3).
|
||||
* IMPORTANT: these are only valid for 8-bit data precision!
|
||||
* (Would jutils.c be a more reasonable place to put this?)
|
||||
*/
|
||||
|
||||
GLOBAL(JHUFF_TBL *)
|
||||
jpeg_std_huff_table (j_common_ptr cinfo, boolean isDC, int tblno)
|
||||
{
|
||||
JHUFF_TBL **htblptr, *htbl;
|
||||
const UINT8 *bits, *val;
|
||||
int nsymbols, len;
|
||||
|
||||
static const UINT8 bits_dc_luminance[17] =
|
||||
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
|
||||
static const UINT8 val_dc_luminance[] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
static const UINT8 bits_dc_chrominance[17] =
|
||||
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
|
||||
static const UINT8 val_dc_chrominance[] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
static const UINT8 bits_ac_luminance[17] =
|
||||
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
|
||||
static const UINT8 val_ac_luminance[] =
|
||||
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
|
||||
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
|
||||
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
|
||||
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
|
||||
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
|
||||
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
|
||||
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
|
||||
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
|
||||
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa };
|
||||
|
||||
static const UINT8 bits_ac_chrominance[17] =
|
||||
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
|
||||
static const UINT8 val_ac_chrominance[] =
|
||||
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
|
||||
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
|
||||
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
|
||||
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
|
||||
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
|
||||
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
|
||||
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa };
|
||||
|
||||
if (cinfo->is_decompressor) {
|
||||
if (isDC)
|
||||
htblptr = ((j_decompress_ptr) cinfo)->dc_huff_tbl_ptrs;
|
||||
else
|
||||
htblptr = ((j_decompress_ptr) cinfo)->ac_huff_tbl_ptrs;
|
||||
} else {
|
||||
if (isDC)
|
||||
htblptr = ((j_compress_ptr) cinfo)->dc_huff_tbl_ptrs;
|
||||
else
|
||||
htblptr = ((j_compress_ptr) cinfo)->ac_huff_tbl_ptrs;
|
||||
}
|
||||
|
||||
switch (tblno) {
|
||||
case 0:
|
||||
if (isDC) {
|
||||
bits = bits_dc_luminance;
|
||||
val = val_dc_luminance;
|
||||
} else {
|
||||
bits = bits_ac_luminance;
|
||||
val = val_ac_luminance;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (isDC) {
|
||||
bits = bits_dc_chrominance;
|
||||
val = val_dc_chrominance;
|
||||
} else {
|
||||
bits = bits_ac_chrominance;
|
||||
val = val_ac_chrominance;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
|
||||
return NULL; /* avoid compiler warnings for uninitialized variables */
|
||||
}
|
||||
|
||||
if (htblptr[tblno] == NULL)
|
||||
htblptr[tblno] = jpeg_alloc_huff_table(cinfo);
|
||||
|
||||
htbl = htblptr[tblno];
|
||||
|
||||
/* Copy the number-of-symbols-of-each-code-length counts */
|
||||
MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
|
||||
|
||||
/* Validate the counts. We do this here mainly so we can copy the right
|
||||
* number of symbols from the val[] array, without risking marching off
|
||||
* the end of memory. jxhuff.c will do a more thorough test later.
|
||||
*/
|
||||
nsymbols = 0;
|
||||
for (len = 1; len <= 16; len++)
|
||||
nsymbols += bits[len];
|
||||
if (nsymbols > 256)
|
||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||
|
||||
if (nsymbols > 0)
|
||||
MEMCOPY(htbl->huffval, val, nsymbols * SIZEOF(UINT8));
|
||||
|
||||
/* Initialize sent_table FALSE so table will be written to JPEG file. */
|
||||
htbl->sent_table = FALSE;
|
||||
|
||||
return htbl;
|
||||
}
|
||||
|
||||
Vendored
+14
-103
@@ -2,7 +2,7 @@
|
||||
* jcparam.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* Modified 2003-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -162,112 +162,23 @@ jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
|
||||
|
||||
|
||||
/*
|
||||
* Huffman table setup routines
|
||||
* Reset standard Huffman tables
|
||||
*/
|
||||
|
||||
LOCAL(void)
|
||||
add_huff_table (j_compress_ptr cinfo,
|
||||
JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
|
||||
/* Define a Huffman table */
|
||||
{
|
||||
int nsymbols, len;
|
||||
|
||||
if (*htblptr == NULL)
|
||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||
|
||||
/* Copy the number-of-symbols-of-each-code-length counts */
|
||||
MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
|
||||
|
||||
/* Validate the counts. We do this here mainly so we can copy the right
|
||||
* number of symbols from the val[] array, without risking marching off
|
||||
* the end of memory. jchuff.c will do a more thorough test later.
|
||||
*/
|
||||
nsymbols = 0;
|
||||
for (len = 1; len <= 16; len++)
|
||||
nsymbols += bits[len];
|
||||
if (nsymbols < 1 || nsymbols > 256)
|
||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||
|
||||
MEMCOPY((*htblptr)->huffval, val, nsymbols * SIZEOF(UINT8));
|
||||
|
||||
/* Initialize sent_table FALSE so table will be written to JPEG file. */
|
||||
(*htblptr)->sent_table = FALSE;
|
||||
}
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
std_huff_tables (j_compress_ptr cinfo)
|
||||
/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
|
||||
/* IMPORTANT: these are only valid for 8-bit data precision! */
|
||||
{
|
||||
static const UINT8 bits_dc_luminance[17] =
|
||||
{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
|
||||
static const UINT8 val_dc_luminance[] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
static const UINT8 bits_dc_chrominance[17] =
|
||||
{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
|
||||
static const UINT8 val_dc_chrominance[] =
|
||||
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
|
||||
|
||||
static const UINT8 bits_ac_luminance[17] =
|
||||
{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
|
||||
static const UINT8 val_ac_luminance[] =
|
||||
{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
|
||||
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
|
||||
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
|
||||
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
|
||||
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
|
||||
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
|
||||
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
|
||||
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
|
||||
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
|
||||
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
|
||||
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
|
||||
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
|
||||
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
|
||||
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
|
||||
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
|
||||
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
|
||||
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
|
||||
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa };
|
||||
|
||||
static const UINT8 bits_ac_chrominance[17] =
|
||||
{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
|
||||
static const UINT8 val_ac_chrominance[] =
|
||||
{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
|
||||
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
|
||||
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
|
||||
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
|
||||
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
|
||||
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
|
||||
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
|
||||
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
|
||||
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
|
||||
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
|
||||
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
|
||||
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
|
||||
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
|
||||
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
|
||||
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
|
||||
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
|
||||
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
|
||||
0xf9, 0xfa };
|
||||
|
||||
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
|
||||
bits_dc_luminance, val_dc_luminance);
|
||||
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
|
||||
bits_ac_luminance, val_ac_luminance);
|
||||
add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
|
||||
bits_dc_chrominance, val_dc_chrominance);
|
||||
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
|
||||
bits_ac_chrominance, val_ac_chrominance);
|
||||
if (cinfo->dc_huff_tbl_ptrs[0] != NULL)
|
||||
(void) jpeg_std_huff_table((j_common_ptr) cinfo, TRUE, 0);
|
||||
|
||||
if (cinfo->ac_huff_tbl_ptrs[0] != NULL)
|
||||
(void) jpeg_std_huff_table((j_common_ptr) cinfo, FALSE, 0);
|
||||
|
||||
if (cinfo->dc_huff_tbl_ptrs[1] != NULL)
|
||||
(void) jpeg_std_huff_table((j_common_ptr) cinfo, TRUE, 1);
|
||||
|
||||
if (cinfo->ac_huff_tbl_ptrs[1] != NULL)
|
||||
(void) jpeg_std_huff_table((j_common_ptr) cinfo, FALSE, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +217,7 @@ jpeg_set_defaults (j_compress_ptr cinfo)
|
||||
cinfo->data_precision = BITS_IN_JSAMPLE;
|
||||
/* Set up two quantization tables using default quality of 75 */
|
||||
jpeg_set_quality(cinfo, 75, TRUE);
|
||||
/* Set up two Huffman tables */
|
||||
/* Reset standard Huffman tables */
|
||||
std_huff_tables(cinfo);
|
||||
|
||||
/* Initialize default arithmetic coding conditioning */
|
||||
|
||||
Vendored
+14
-14
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jdarith.c
|
||||
*
|
||||
* Developed 1997-2015 by Guido Vollbeding.
|
||||
* Developed 1997-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -280,7 +280,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if ((m = arith_decode(cinfo, st)) != 0) {
|
||||
st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
|
||||
while (arith_decode(cinfo, st)) {
|
||||
if ((m <<= 1) == 0x8000) {
|
||||
if ((m <<= 1) == (int) 0x8000U) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* magnitude overflow */
|
||||
return TRUE;
|
||||
@@ -370,7 +370,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
st = entropy->ac_stats[tbl] +
|
||||
(k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
|
||||
while (arith_decode(cinfo, st)) {
|
||||
if ((m <<= 1) == 0x8000) {
|
||||
if ((m <<= 1) == (int) 0x8000U) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* magnitude overflow */
|
||||
return TRUE;
|
||||
@@ -404,7 +404,8 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
|
||||
unsigned char *st;
|
||||
int p1, blkn;
|
||||
JCOEF p1;
|
||||
int blkn;
|
||||
|
||||
/* Process restart marker if needed */
|
||||
if (cinfo->restart_interval) {
|
||||
@@ -440,7 +441,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
JCOEFPTR thiscoef;
|
||||
unsigned char *st;
|
||||
int tbl, k, kex;
|
||||
int p1, m1;
|
||||
JCOEF p1, m1;
|
||||
const int * natural_order;
|
||||
|
||||
/* Process restart marker if needed */
|
||||
@@ -459,7 +460,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
|
||||
|
||||
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
m1 = -p1; /* -1 in the bit position being coded */
|
||||
|
||||
/* Establish EOBx (previous stage end-of-block) index */
|
||||
kex = cinfo->Se;
|
||||
@@ -555,7 +556,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if ((m = arith_decode(cinfo, st)) != 0) {
|
||||
st = entropy->dc_stats[tbl] + 20; /* Table F.4: X1 = 20 */
|
||||
while (arith_decode(cinfo, st)) {
|
||||
if ((m <<= 1) == 0x8000) {
|
||||
if ((m <<= 1) == (int) 0x8000U) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* magnitude overflow */
|
||||
return TRUE;
|
||||
@@ -612,7 +613,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
st = entropy->ac_stats[tbl] +
|
||||
(k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
|
||||
while (arith_decode(cinfo, st)) {
|
||||
if ((m <<= 1) == 0x8000) {
|
||||
if ((m <<= 1) == (int) 0x8000U) {
|
||||
WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
|
||||
entropy->ct = -1; /* magnitude overflow */
|
||||
return TRUE;
|
||||
@@ -766,9 +767,8 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
|
||||
arith_entropy_ptr entropy;
|
||||
int i;
|
||||
|
||||
entropy = (arith_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(arith_entropy_decoder));
|
||||
entropy = (arith_entropy_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(arith_entropy_decoder));
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass;
|
||||
entropy->pub.finish_pass = finish_pass;
|
||||
@@ -785,9 +785,9 @@ jinit_arith_decoder (j_decompress_ptr cinfo)
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Create progression status table */
|
||||
int *coef_bit_ptr, ci;
|
||||
cinfo->coef_bits = (int (*)[DCTSIZE2])
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components*DCTSIZE2*SIZEOF(int));
|
||||
cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components * DCTSIZE2 * SIZEOF(int));
|
||||
coef_bit_ptr = & cinfo->coef_bits[0][0];
|
||||
for (ci = 0; ci < cinfo->num_components; ci++)
|
||||
for (i = 0; i < DCTSIZE2; i++)
|
||||
|
||||
Vendored
+10
-13
@@ -2,7 +2,7 @@
|
||||
* jdatadst.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2017 by Guido Vollbeding.
|
||||
* Modified 2009-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -46,7 +46,7 @@ typedef struct {
|
||||
struct jpeg_destination_mgr pub; /* public fields */
|
||||
|
||||
unsigned char ** outbuffer; /* target buffer */
|
||||
unsigned long * outsize;
|
||||
size_t * outsize;
|
||||
unsigned char * newbuffer; /* newly allocated buffer */
|
||||
JOCTET * buffer; /* start of buffer */
|
||||
size_t bufsize;
|
||||
@@ -66,9 +66,8 @@ init_destination (j_compress_ptr cinfo)
|
||||
my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
|
||||
|
||||
/* Allocate the output buffer --- it will be released when done with image */
|
||||
dest->buffer = (JOCTET *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||
dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||
|
||||
dest->pub.next_output_byte = dest->buffer;
|
||||
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
||||
@@ -131,7 +130,7 @@ empty_mem_output_buffer (j_compress_ptr cinfo)
|
||||
nextbuffer = (JOCTET *) malloc(nextsize);
|
||||
|
||||
if (nextbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 11);
|
||||
|
||||
MEMCOPY(nextbuffer, dest->buffer, dest->bufsize);
|
||||
|
||||
@@ -204,9 +203,8 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
|
||||
* sizes may be different. Caveat programmer.
|
||||
*/
|
||||
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->dest = (struct jpeg_destination_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_destination_mgr));
|
||||
cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_destination_mgr));
|
||||
}
|
||||
|
||||
dest = (my_dest_ptr) cinfo->dest;
|
||||
@@ -233,7 +231,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_mem_dest (j_compress_ptr cinfo,
|
||||
unsigned char ** outbuffer, unsigned long * outsize)
|
||||
unsigned char ** outbuffer, size_t * outsize)
|
||||
{
|
||||
my_mem_dest_ptr dest;
|
||||
|
||||
@@ -244,9 +242,8 @@ jpeg_mem_dest (j_compress_ptr cinfo,
|
||||
* can be written to the same buffer without re-executing jpeg_mem_dest.
|
||||
*/
|
||||
if (cinfo->dest == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->dest = (struct jpeg_destination_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_mem_destination_mgr));
|
||||
cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_mem_destination_mgr));
|
||||
}
|
||||
|
||||
dest = (my_mem_dest_ptr) cinfo->dest;
|
||||
|
||||
Vendored
+15
-16
@@ -2,7 +2,7 @@
|
||||
* jdatasrc.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2015 by Guido Vollbeding.
|
||||
* Modified 2009-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -156,21 +156,23 @@ METHODDEF(void)
|
||||
skip_input_data (j_decompress_ptr cinfo, long num_bytes)
|
||||
{
|
||||
struct jpeg_source_mgr * src = cinfo->src;
|
||||
size_t nbytes;
|
||||
|
||||
/* Just a dumb implementation for now. Could use fseek() except
|
||||
* it doesn't work on pipes. Not clear that being smart is worth
|
||||
* any trouble anyway --- large skips are infrequent.
|
||||
*/
|
||||
if (num_bytes > 0) {
|
||||
while (num_bytes > (long) src->bytes_in_buffer) {
|
||||
num_bytes -= (long) src->bytes_in_buffer;
|
||||
nbytes = (size_t) num_bytes;
|
||||
while (nbytes > src->bytes_in_buffer) {
|
||||
nbytes -= src->bytes_in_buffer;
|
||||
(void) (*src->fill_input_buffer) (cinfo);
|
||||
/* note we assume that fill_input_buffer will never return FALSE,
|
||||
* so suspension need not be handled.
|
||||
*/
|
||||
}
|
||||
src->next_input_byte += (size_t) num_bytes;
|
||||
src->bytes_in_buffer -= (size_t) num_bytes;
|
||||
src->next_input_byte += nbytes;
|
||||
src->bytes_in_buffer -= nbytes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,13 +221,11 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
|
||||
* manager serially with the same JPEG object. Caveat programmer.
|
||||
*/
|
||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_source_mgr));
|
||||
cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_source_mgr));
|
||||
src = (my_src_ptr) cinfo->src;
|
||||
src->buffer = (JOCTET *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
INPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||
src->buffer = (JOCTET *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET));
|
||||
}
|
||||
|
||||
src = (my_src_ptr) cinfo->src;
|
||||
@@ -247,7 +247,7 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_mem_src (j_decompress_ptr cinfo,
|
||||
const unsigned char * inbuffer, unsigned long insize)
|
||||
const unsigned char * inbuffer, size_t insize)
|
||||
{
|
||||
struct jpeg_source_mgr * src;
|
||||
|
||||
@@ -259,9 +259,8 @@ jpeg_mem_src (j_decompress_ptr cinfo,
|
||||
* the first one.
|
||||
*/
|
||||
if (cinfo->src == NULL) { /* first time for this JPEG object? */
|
||||
cinfo->src = (struct jpeg_source_mgr *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(struct jpeg_source_mgr));
|
||||
cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(struct jpeg_source_mgr));
|
||||
}
|
||||
|
||||
src = cinfo->src;
|
||||
@@ -270,6 +269,6 @@ jpeg_mem_src (j_decompress_ptr cinfo,
|
||||
src->skip_input_data = skip_input_data;
|
||||
src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
|
||||
src->term_source = term_source;
|
||||
src->bytes_in_buffer = (size_t) insize;
|
||||
src->bytes_in_buffer = insize;
|
||||
src->next_input_byte = (const JOCTET *) inbuffer;
|
||||
}
|
||||
|
||||
Vendored
+59
-71
@@ -2,7 +2,7 @@
|
||||
* jdcolor.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2011-2017 by Guido Vollbeding.
|
||||
* Modified 2011-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -124,28 +124,22 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
INT32 x;
|
||||
SHIFT_TEMPS
|
||||
|
||||
cconvert->Cr_r_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cb_b_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cr_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
cconvert->Cb_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
|
||||
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
|
||||
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
|
||||
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
|
||||
/* Cr=>R value is nearest int to 1.402 * x */
|
||||
cconvert->Cr_r_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
|
||||
cconvert->Cr_r_tab[i] = (int) DESCALE(FIX(1.402) * x, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 1.772 * x */
|
||||
cconvert->Cb_b_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
|
||||
cconvert->Cb_b_tab[i] = (int) DESCALE(FIX(1.772) * x, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -0.714136286 * x */
|
||||
cconvert->Cr_g_tab[i] = (- FIX(0.714136286)) * x;
|
||||
/* Cb=>G value is scaled-up -0.344136286 * x */
|
||||
@@ -164,28 +158,22 @@ build_bg_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
INT32 x;
|
||||
SHIFT_TEMPS
|
||||
|
||||
cconvert->Cr_r_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cb_b_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cr_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
cconvert->Cb_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
cconvert->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
cconvert->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
|
||||
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
|
||||
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
|
||||
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
|
||||
/* Cr=>R value is nearest int to 2.804 * x */
|
||||
cconvert->Cr_r_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(2.804) * x + ONE_HALF, SCALEBITS);
|
||||
cconvert->Cr_r_tab[i] = (int) DESCALE(FIX(2.804) * x, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 3.544 * x */
|
||||
cconvert->Cb_b_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(3.544) * x + ONE_HALF, SCALEBITS);
|
||||
cconvert->Cb_b_tab[i] = (int) DESCALE(FIX(3.544) * x, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -1.428272572 * x */
|
||||
cconvert->Cr_g_tab[i] = (- FIX(1.428272572)) * x;
|
||||
/* Cb=>G value is scaled-up -0.688272572 * x */
|
||||
@@ -201,6 +189,7 @@ build_bg_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
* Note that we change from noninterleaved, one-plane-per-component format
|
||||
* to interleaved-pixel format. The output buffer is therefore three times
|
||||
* as wide as the input buffer.
|
||||
*
|
||||
* A starting row offset is provided only for the input buffer. The caller
|
||||
* can easily adjust the passed output_buf value to accommodate any row
|
||||
* offset required on that side.
|
||||
@@ -264,9 +253,8 @@ build_rgb_y_table (j_decompress_ptr cinfo)
|
||||
INT32 i;
|
||||
|
||||
/* Allocate and fill in the conversion tables. */
|
||||
cconvert->rgb_y_tab = rgb_y_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(TABLE_SIZE * SIZEOF(INT32)));
|
||||
cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, TABLE_SIZE * SIZEOF(INT32));
|
||||
|
||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||
rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i;
|
||||
@@ -286,8 +274,8 @@ rgb_gray_convert (j_decompress_ptr cinfo,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
@@ -313,6 +301,7 @@ rgb_gray_convert (j_decompress_ptr cinfo,
|
||||
|
||||
|
||||
/*
|
||||
* Convert some rows of samples to the output colorspace.
|
||||
* [R-G,G,B-G] to [R,G,B] conversion with modulo calculation
|
||||
* (inverse color transform).
|
||||
* This can be seen as an adaption of the general YCbCr->RGB
|
||||
@@ -364,8 +353,8 @@ rgb1_gray_convert (j_decompress_ptr cinfo,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register int r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
@@ -396,6 +385,7 @@ rgb1_gray_convert (j_decompress_ptr cinfo,
|
||||
|
||||
|
||||
/*
|
||||
* Convert some rows of samples to the output colorspace.
|
||||
* No colorspace change, but conversion from separate-planes
|
||||
* to interleaved representation.
|
||||
*/
|
||||
@@ -430,6 +420,7 @@ rgb_convert (j_decompress_ptr cinfo,
|
||||
/*
|
||||
* Color conversion for no colorspace change: just copy the data,
|
||||
* converting from separate-planes to interleaved representation.
|
||||
* We assume out_color_components == num_components.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
@@ -437,20 +428,21 @@ null_convert (j_decompress_ptr cinfo,
|
||||
JSAMPIMAGE input_buf, JDIMENSION input_row,
|
||||
JSAMPARRAY output_buf, int num_rows)
|
||||
{
|
||||
int ci;
|
||||
register int nc = cinfo->num_components;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr;
|
||||
register JDIMENSION col;
|
||||
register JDIMENSION count;
|
||||
register int num_comps = cinfo->num_components;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
int ci;
|
||||
|
||||
while (--num_rows >= 0) {
|
||||
for (ci = 0; ci < nc; ci++) {
|
||||
/* It seems fastest to make a separate pass for each component. */
|
||||
for (ci = 0; ci < num_comps; ci++) {
|
||||
inptr = input_buf[ci][input_row];
|
||||
outptr = output_buf[0] + ci;
|
||||
for (col = 0; col < num_cols; col++) {
|
||||
*outptr = *inptr++; /* needn't bother with GETJSAMPLE() here */
|
||||
outptr += nc;
|
||||
for (count = num_cols; count > 0; count--) {
|
||||
*outptr = *inptr++; /* don't need GETJSAMPLE() here */
|
||||
outptr += num_comps;
|
||||
}
|
||||
}
|
||||
input_row++;
|
||||
@@ -504,9 +496,10 @@ gray_rgb_convert (j_decompress_ptr cinfo,
|
||||
|
||||
|
||||
/*
|
||||
* Adobe-style YCCK->CMYK conversion.
|
||||
* We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
|
||||
* conversion as above, while passing K (black) unchanged.
|
||||
* Convert some rows of samples to the output colorspace.
|
||||
* This version handles Adobe-style YCCK->CMYK conversion,
|
||||
* where we convert YCbCr to R=1-C, G=1-M, and B=1-Y using the
|
||||
* same conversion as above, while passing K (black) unchanged.
|
||||
* We assume build_ycc_rgb_table has been called.
|
||||
*/
|
||||
|
||||
@@ -577,9 +570,8 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
my_cconvert_ptr cconvert;
|
||||
int ci;
|
||||
|
||||
cconvert = (my_cconvert_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_color_deconverter));
|
||||
cconvert = (my_cconvert_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_color_deconverter));
|
||||
cinfo->cconvert = &cconvert->pub;
|
||||
cconvert->pub.start_pass = start_pass_dcolor;
|
||||
|
||||
@@ -607,7 +599,6 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
default: /* JCS_UNKNOWN can be anything */
|
||||
if (cinfo->num_components < 1)
|
||||
ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Support color transform only for RGB colorspaces */
|
||||
@@ -684,19 +675,18 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
|
||||
case JCS_BG_RGB:
|
||||
cinfo->out_color_components = RGB_PIXELSIZE;
|
||||
if (cinfo->jpeg_color_space == JCS_BG_RGB) {
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb1_rgb_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
} else
|
||||
if (cinfo->jpeg_color_space != JCS_BG_RGB)
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
switch (cinfo->color_transform) {
|
||||
case JCT_NONE:
|
||||
cconvert->pub.color_convert = rgb_convert;
|
||||
break;
|
||||
case JCT_SUBTRACT_GREEN:
|
||||
cconvert->pub.color_convert = rgb1_rgb_convert;
|
||||
break;
|
||||
default:
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
}
|
||||
break;
|
||||
|
||||
case JCS_CMYK:
|
||||
@@ -714,14 +704,12 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Permit null conversion to same output space */
|
||||
if (cinfo->out_color_space == cinfo->jpeg_color_space) {
|
||||
cinfo->out_color_components = cinfo->num_components;
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
} else /* unsupported non-null conversion */
|
||||
default: /* permit null conversion to same output space */
|
||||
if (cinfo->out_color_space != cinfo->jpeg_color_space)
|
||||
/* unsupported non-null conversion */
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
break;
|
||||
cinfo->out_color_components = cinfo->num_components;
|
||||
cconvert->pub.color_convert = null_convert;
|
||||
}
|
||||
|
||||
if (cinfo->quantize_colors)
|
||||
|
||||
Vendored
+1
-8
@@ -2,7 +2,7 @@
|
||||
* jdct.h
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2017 by Guido Vollbeding.
|
||||
* Modified 2002-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -358,13 +358,6 @@ EXTERN(void) jpeg_idct_1x2
|
||||
|
||||
#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
|
||||
|
||||
/* Descale and correctly round an INT32 value that's scaled by N bits.
|
||||
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
|
||||
* the fudge factor is correct for either sign of X.
|
||||
*/
|
||||
|
||||
#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
|
||||
|
||||
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
|
||||
* This macro is used only when the two inputs will actually be no more than
|
||||
* 16 bits wide, so that a 16x16->32 bit multiply can be used instead of a
|
||||
|
||||
Vendored
+56
-50
@@ -2,7 +2,7 @@
|
||||
* jdhuff.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2006-2016 by Guido Vollbeding.
|
||||
* Modified 2006-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -341,13 +341,12 @@ jpeg_make_d_derived_tbl (j_decompress_ptr cinfo, boolean isDC, int tblno,
|
||||
htbl =
|
||||
isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
|
||||
if (htbl == NULL)
|
||||
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
|
||||
htbl = jpeg_std_huff_table((j_common_ptr) cinfo, isDC, tblno);
|
||||
|
||||
/* Allocate a workspace if we haven't already done so. */
|
||||
if (*pdtbl == NULL)
|
||||
*pdtbl = (d_derived_tbl *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(d_derived_tbl));
|
||||
*pdtbl = (d_derived_tbl *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(d_derived_tbl));
|
||||
dtbl = *pdtbl;
|
||||
dtbl->pub = htbl; /* fill in back link */
|
||||
|
||||
@@ -706,7 +705,7 @@ process_restart (j_decompress_ptr cinfo)
|
||||
|
||||
METHODDEF(boolean)
|
||||
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int Al = cinfo->Al;
|
||||
register int s, r;
|
||||
@@ -730,7 +729,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
|
||||
ASSIGN_STATE(state, entropy->saved);
|
||||
|
||||
/* Outer loop handles each block in the MCU */
|
||||
@@ -759,12 +758,13 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
|
||||
ASSIGN_STATE(entropy->saved, state);
|
||||
}
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
/* Account for restart interval if using restarts */
|
||||
if (cinfo->restart_interval)
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -777,7 +777,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
METHODDEF(boolean)
|
||||
decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
register int s, k, r;
|
||||
unsigned int EOBRUN;
|
||||
@@ -809,7 +809,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (EOBRUN) /* if it's a band of zeroes... */
|
||||
EOBRUN--; /* ...process it now (we do nothing) */
|
||||
else {
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
|
||||
Se = cinfo->Se;
|
||||
Al = cinfo->Al;
|
||||
natural_order = cinfo->natural_order;
|
||||
@@ -842,15 +842,16 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
}
|
||||
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
|
||||
}
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
/* Account for restart interval if using restarts */
|
||||
if (cinfo->restart_interval)
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -864,9 +865,10 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
METHODDEF(boolean)
|
||||
decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
int p1, blkn;
|
||||
JCOEF p1;
|
||||
int blkn;
|
||||
BITREAD_STATE_VARS;
|
||||
|
||||
/* Process restart marker if needed; may have to suspend */
|
||||
@@ -881,7 +883,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
*/
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
|
||||
|
||||
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
|
||||
@@ -896,10 +898,11 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
/* Account for restart interval if using restarts */
|
||||
if (cinfo->restart_interval)
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -911,11 +914,12 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
METHODDEF(boolean)
|
||||
decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
{
|
||||
{
|
||||
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
|
||||
register int s, k, r;
|
||||
unsigned int EOBRUN;
|
||||
int Se, p1, m1;
|
||||
int Se;
|
||||
JCOEF p1, m1;
|
||||
const int * natural_order;
|
||||
JBLOCKROW block;
|
||||
JCOEFPTR thiscoef;
|
||||
@@ -937,11 +941,11 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
|
||||
Se = cinfo->Se;
|
||||
p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
|
||||
m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
|
||||
m1 = -p1; /* -1 in the bit position being coded */
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
|
||||
EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
|
||||
|
||||
/* There is always only one block per MCU */
|
||||
@@ -1043,12 +1047,13 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
|
||||
entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
|
||||
}
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
/* Account for restart interval if using restarts */
|
||||
if (cinfo->restart_interval)
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -1091,7 +1096,7 @@ decode_mcu_sub (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
Se = cinfo->lim_Se;
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
|
||||
ASSIGN_STATE(state, entropy->saved);
|
||||
|
||||
/* Outer loop handles each block in the MCU */
|
||||
@@ -1178,12 +1183,13 @@ decode_mcu_sub (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
|
||||
ASSIGN_STATE(entropy->saved, state);
|
||||
}
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
/* Account for restart interval if using restarts */
|
||||
if (cinfo->restart_interval)
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1215,7 +1221,7 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
/* Load up working state */
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
|
||||
ASSIGN_STATE(state, entropy->saved);
|
||||
|
||||
/* Outer loop handles each block in the MCU */
|
||||
@@ -1302,12 +1308,13 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
}
|
||||
|
||||
/* Completed MCU, so update state */
|
||||
BITREAD_SAVE_STATE(cinfo,entropy->bitstate);
|
||||
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
|
||||
ASSIGN_STATE(entropy->saved, state);
|
||||
}
|
||||
|
||||
/* Account for restart interval (no-op if not using restarts) */
|
||||
entropy->restarts_to_go--;
|
||||
/* Account for restart interval if using restarts */
|
||||
if (cinfo->restart_interval)
|
||||
entropy->restarts_to_go--;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1343,11 +1350,11 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
goto bad;
|
||||
}
|
||||
if (cinfo->Al > 13) { /* need not check for < 0 */
|
||||
/* Arguably the maximum Al value should be less than 13 for 8-bit precision,
|
||||
* but the spec doesn't say so, and we try to be liberal about what we
|
||||
* accept. Note: large Al values could result in out-of-range DC
|
||||
* coefficients during early scans, leading to bizarre displays due to
|
||||
* overflows in the IDCT math. But we won't crash.
|
||||
/* Arguably the maximum Al value should be less than 13 for 8-bit
|
||||
* precision, but the spec doesn't say so, and we try to be liberal
|
||||
* about what we accept. Note: large Al values could result in
|
||||
* out-of-range DC coefficients during early scans, leading to bizarre
|
||||
* displays due to overflows in the IDCT math. But we won't crash.
|
||||
*/
|
||||
bad:
|
||||
ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
|
||||
@@ -1451,7 +1458,8 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
compptr = cinfo->cur_comp_info[ci];
|
||||
/* Precalculate which table to use for each block */
|
||||
entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
|
||||
entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
|
||||
entropy->ac_cur_tbls[blkn] = /* AC needs no table when not present */
|
||||
cinfo->lim_Se ? entropy->ac_derived_tbls[compptr->ac_tbl_no] : NULL;
|
||||
/* Decide whether we really care about the coefficient values */
|
||||
if (compptr->component_needed) {
|
||||
ci = compptr->DCT_v_scaled_size;
|
||||
@@ -1494,7 +1502,6 @@ start_pass_huff_decoder (j_decompress_ptr cinfo)
|
||||
if (ci <= 0 || ci > 8) ci = 8;
|
||||
if (i <= 0 || i > 8) i = 8;
|
||||
entropy->coef_limit[blkn] = 1 + jpeg_zigzag_order[ci - 1][i - 1];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
entropy->coef_limit[blkn] = 0;
|
||||
@@ -1522,9 +1529,8 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
|
||||
huff_entropy_ptr entropy;
|
||||
int i;
|
||||
|
||||
entropy = (huff_entropy_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(huff_entropy_decoder));
|
||||
entropy = (huff_entropy_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(huff_entropy_decoder));
|
||||
cinfo->entropy = &entropy->pub;
|
||||
entropy->pub.start_pass = start_pass_huff_decoder;
|
||||
entropy->pub.finish_pass = finish_pass_huff;
|
||||
@@ -1532,9 +1538,9 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
|
||||
if (cinfo->progressive_mode) {
|
||||
/* Create progression status table */
|
||||
int *coef_bit_ptr, ci;
|
||||
cinfo->coef_bits = (int (*)[DCTSIZE2])
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components*DCTSIZE2*SIZEOF(int));
|
||||
cinfo->coef_bits = (int (*)[DCTSIZE2]) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
cinfo->num_components * DCTSIZE2 * SIZEOF(int));
|
||||
coef_bit_ptr = & cinfo->coef_bits[0][0];
|
||||
for (ci = 0; ci < cinfo->num_components; ci++)
|
||||
for (i = 0; i < DCTSIZE2; i++)
|
||||
@@ -1545,7 +1551,7 @@ jinit_huff_decoder (j_decompress_ptr cinfo)
|
||||
entropy->derived_tbls[i] = NULL;
|
||||
}
|
||||
} else {
|
||||
/* Mark tables unallocated */
|
||||
/* Mark derived tables unallocated */
|
||||
for (i = 0; i < NUM_HUFF_TBLS; i++) {
|
||||
entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
|
||||
}
|
||||
|
||||
Vendored
+7
-13
@@ -2,7 +2,7 @@
|
||||
* jdmarker.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2009-2013 by Guido Vollbeding.
|
||||
* Modified 2009-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -496,8 +496,6 @@ get_dht (j_decompress_ptr cinfo)
|
||||
if (count > 256 || ((INT32) count) > length)
|
||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||
|
||||
MEMZERO(huffval, SIZEOF(huffval)); /* pre-zero array for later copy */
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
INPUT_BYTE(cinfo, huffval[i], return FALSE);
|
||||
|
||||
@@ -517,7 +515,8 @@ get_dht (j_decompress_ptr cinfo)
|
||||
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
|
||||
|
||||
MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
|
||||
MEMCOPY((*htblptr)->huffval, huffval, SIZEOF((*htblptr)->huffval));
|
||||
if (count > 0)
|
||||
MEMCOPY((*htblptr)->huffval, huffval, count * SIZEOF(UINT8));
|
||||
}
|
||||
|
||||
if (length != 0)
|
||||
@@ -577,14 +576,14 @@ get_dqt (j_decompress_ptr cinfo)
|
||||
count = DCTSIZE2;
|
||||
}
|
||||
|
||||
switch (count) {
|
||||
switch ((int) count) {
|
||||
case (2*2): natural_order = jpeg_natural_order2; break;
|
||||
case (3*3): natural_order = jpeg_natural_order3; break;
|
||||
case (4*4): natural_order = jpeg_natural_order4; break;
|
||||
case (5*5): natural_order = jpeg_natural_order5; break;
|
||||
case (6*6): natural_order = jpeg_natural_order6; break;
|
||||
case (7*7): natural_order = jpeg_natural_order7; break;
|
||||
default: natural_order = jpeg_natural_order; break;
|
||||
default: natural_order = jpeg_natural_order;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
@@ -784,7 +783,6 @@ examine_app0 (j_decompress_ptr cinfo, JOCTET FAR * data,
|
||||
default:
|
||||
TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION,
|
||||
GETJOCTET(data[5]), (int) totallen);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Start of APP0 does not match "JFIF" or "JFXX", or too short */
|
||||
@@ -858,7 +856,6 @@ get_interesting_appn (j_decompress_ptr cinfo)
|
||||
default:
|
||||
/* can't get here unless jpeg_save_markers chooses wrong processor */
|
||||
ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
|
||||
break;
|
||||
}
|
||||
|
||||
/* skip any remaining data -- could be lots */
|
||||
@@ -964,7 +961,6 @@ save_marker (j_decompress_ptr cinfo)
|
||||
default:
|
||||
TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker,
|
||||
(int) (data_length + length));
|
||||
break;
|
||||
}
|
||||
|
||||
/* skip any remaining data -- could be lots */
|
||||
@@ -1240,7 +1236,6 @@ read_markers (j_decompress_ptr cinfo)
|
||||
* ought to change!
|
||||
*/
|
||||
ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
|
||||
break;
|
||||
}
|
||||
/* Successfully processed marker, so reset state variable */
|
||||
cinfo->unread_marker = 0;
|
||||
@@ -1416,9 +1411,8 @@ jinit_marker_reader (j_decompress_ptr cinfo)
|
||||
int i;
|
||||
|
||||
/* Create subobject in permanent pool */
|
||||
marker = (my_marker_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
|
||||
SIZEOF(my_marker_reader));
|
||||
marker = (my_marker_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_marker_reader));
|
||||
cinfo->marker = &marker->pub;
|
||||
/* Initialize public method pointers */
|
||||
marker->pub.reset_marker_reader = reset_marker_reader;
|
||||
|
||||
Vendored
+24
-23
@@ -2,7 +2,7 @@
|
||||
* jdmaster.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2002-2017 by Guido Vollbeding.
|
||||
* Modified 2002-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -104,7 +104,7 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
*/
|
||||
{
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
int ci;
|
||||
int ci, ssize;
|
||||
jpeg_component_info *compptr;
|
||||
#endif
|
||||
|
||||
@@ -124,19 +124,23 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
*/
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
int ssize = 1;
|
||||
while (cinfo->min_DCT_h_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) == 0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
ssize = 1;
|
||||
if (! cinfo->raw_data_out)
|
||||
while (cinfo->min_DCT_h_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) ==
|
||||
0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size * ssize;
|
||||
ssize = 1;
|
||||
while (cinfo->min_DCT_v_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) == 0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
if (! cinfo->raw_data_out)
|
||||
while (cinfo->min_DCT_v_scaled_size * ssize <=
|
||||
(cinfo->do_fancy_upsampling ? DCTSIZE : DCTSIZE / 2) &&
|
||||
(cinfo->max_v_samp_factor % (compptr->v_samp_factor * ssize * 2)) ==
|
||||
0) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size * ssize;
|
||||
|
||||
/* We don't support IDCT ratios larger than 2. */
|
||||
@@ -144,13 +148,10 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size * 2;
|
||||
else if (compptr->DCT_v_scaled_size > compptr->DCT_h_scaled_size * 2)
|
||||
compptr->DCT_v_scaled_size = compptr->DCT_h_scaled_size * 2;
|
||||
}
|
||||
|
||||
/* Recompute downsampled dimensions of components;
|
||||
* application needs to know these if using raw downsampled data.
|
||||
*/
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
/* Recompute downsampled dimensions of components;
|
||||
* application needs to know these if using raw downsampled data.
|
||||
*/
|
||||
/* Size in samples, after IDCT scaling */
|
||||
compptr->downsampled_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width *
|
||||
@@ -172,8 +173,10 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
break;
|
||||
case JCS_RGB:
|
||||
case JCS_BG_RGB:
|
||||
#if RGB_PIXELSIZE != 3
|
||||
cinfo->out_color_components = RGB_PIXELSIZE;
|
||||
break;
|
||||
#endif /* else share code with YCbCr */
|
||||
case JCS_YCbCr:
|
||||
case JCS_BG_YCC:
|
||||
cinfo->out_color_components = 3;
|
||||
@@ -184,7 +187,6 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
break;
|
||||
default: /* else must be same colorspace as in file */
|
||||
cinfo->out_color_components = cinfo->num_components;
|
||||
break;
|
||||
}
|
||||
cinfo->output_components = (cinfo->quantize_colors ? 1 :
|
||||
cinfo->out_color_components);
|
||||
@@ -525,9 +527,8 @@ jinit_master_decompress (j_decompress_ptr cinfo)
|
||||
{
|
||||
my_master_ptr master;
|
||||
|
||||
master = (my_master_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_decomp_master));
|
||||
master = (my_master_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_decomp_master));
|
||||
cinfo->master = &master->pub;
|
||||
master->pub.prepare_for_output_pass = prepare_for_output_pass;
|
||||
master->pub.finish_output_pass = finish_output_pass;
|
||||
|
||||
Vendored
+26
-39
@@ -2,7 +2,7 @@
|
||||
* jdmerge.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2013-2017 by Guido Vollbeding.
|
||||
* Modified 2013-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -95,28 +95,22 @@ build_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
INT32 x;
|
||||
SHIFT_TEMPS
|
||||
|
||||
upsample->Cr_r_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cb_b_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cr_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
upsample->Cb_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
upsample->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
upsample->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
|
||||
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
|
||||
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
|
||||
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
|
||||
/* Cr=>R value is nearest int to 1.402 * x */
|
||||
upsample->Cr_r_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.402) * x + ONE_HALF, SCALEBITS);
|
||||
upsample->Cr_r_tab[i] = (int) DESCALE(FIX(1.402) * x, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 1.772 * x */
|
||||
upsample->Cb_b_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(1.772) * x + ONE_HALF, SCALEBITS);
|
||||
upsample->Cb_b_tab[i] = (int) DESCALE(FIX(1.772) * x, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -0.714136286 * x */
|
||||
upsample->Cr_g_tab[i] = (- FIX(0.714136286)) * x;
|
||||
/* Cb=>G value is scaled-up -0.344136286 * x */
|
||||
@@ -135,28 +129,22 @@ build_bg_ycc_rgb_table (j_decompress_ptr cinfo)
|
||||
INT32 x;
|
||||
SHIFT_TEMPS
|
||||
|
||||
upsample->Cr_r_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cb_b_tab = (int *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cr_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
upsample->Cb_g_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
upsample->Cr_r_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cb_b_tab = (int *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(int));
|
||||
upsample->Cr_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
upsample->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32));
|
||||
|
||||
for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) {
|
||||
/* i is the actual input pixel value, in the range 0..MAXJSAMPLE */
|
||||
/* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */
|
||||
/* Cr=>R value is nearest int to 2.804 * x */
|
||||
upsample->Cr_r_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(2.804) * x + ONE_HALF, SCALEBITS);
|
||||
upsample->Cr_r_tab[i] = (int) DESCALE(FIX(2.804) * x, SCALEBITS);
|
||||
/* Cb=>B value is nearest int to 3.544 * x */
|
||||
upsample->Cb_b_tab[i] = (int)
|
||||
RIGHT_SHIFT(FIX(3.544) * x + ONE_HALF, SCALEBITS);
|
||||
upsample->Cb_b_tab[i] = (int) DESCALE(FIX(3.544) * x, SCALEBITS);
|
||||
/* Cr=>G value is scaled-up -1.428272572 * x */
|
||||
upsample->Cr_g_tab[i] = (- FIX(1.428272572)) * x;
|
||||
/* Cb=>G value is scaled-up -0.688272572 * x */
|
||||
@@ -419,9 +407,8 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
|
||||
{
|
||||
my_upsample_ptr upsample;
|
||||
|
||||
upsample = (my_upsample_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
SIZEOF(my_upsampler));
|
||||
upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_upsampler));
|
||||
cinfo->upsample = &upsample->pub;
|
||||
upsample->pub.start_pass = start_pass_merged_upsample;
|
||||
upsample->pub.need_context_rows = FALSE;
|
||||
@@ -432,9 +419,9 @@ jinit_merged_upsampler (j_decompress_ptr cinfo)
|
||||
upsample->pub.upsample = merged_2v_upsample;
|
||||
upsample->upmethod = h2v2_merged_upsample;
|
||||
/* Allocate a spare row buffer */
|
||||
upsample->spare_row = (JSAMPROW)
|
||||
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(size_t) (upsample->out_row_width * SIZEOF(JSAMPLE)));
|
||||
upsample->spare_row = (JSAMPROW) (*cinfo->mem->alloc_large)
|
||||
((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(size_t) upsample->out_row_width * SIZEOF(JSAMPLE));
|
||||
} else {
|
||||
upsample->pub.upsample = merged_1v_upsample;
|
||||
upsample->upmethod = h2v1_merged_upsample;
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
* jerror.h
|
||||
*
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modified 1997-2012 by Guido Vollbeding.
|
||||
* Modified 1997-2018 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -84,7 +84,7 @@ JMESSAGE(JERR_EOI_EXPECTED, "Didn't expect more than one scan")
|
||||
JMESSAGE(JERR_FILE_READ, "Input file read error")
|
||||
JMESSAGE(JERR_FILE_WRITE, "Output file write error --- out of disk space?")
|
||||
JMESSAGE(JERR_FRACT_SAMPLE_NOTIMPL, "Fractional sampling not implemented yet")
|
||||
JMESSAGE(JERR_HUFF_CLEN_OVERFLOW, "Huffman code size table overflow")
|
||||
JMESSAGE(JERR_HUFF_CLEN_OUTOFBOUNDS, "Huffman code size table out of bounds")
|
||||
JMESSAGE(JERR_HUFF_MISSING_CODE, "Missing Huffman code table entry")
|
||||
JMESSAGE(JERR_IMAGE_TOO_BIG, "Maximum supported image dimension is %u pixels")
|
||||
JMESSAGE(JERR_INPUT_EMPTY, "Empty input file")
|
||||
|
||||
Vendored
+61
-55
@@ -2,7 +2,7 @@
|
||||
* jfdctint.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modification developed 2003-2015 by Guido Vollbeding.
|
||||
* Modification developed 2003-2018 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -3261,78 +3261,84 @@ jpeg_fdct_6x3 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
|
||||
GLOBAL(void)
|
||||
jpeg_fdct_4x2 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
|
||||
{
|
||||
INT32 tmp0, tmp1;
|
||||
INT32 tmp10, tmp11;
|
||||
DCTELEM *dataptr;
|
||||
DCTELEM tmp0, tmp2, tmp10, tmp12, tmp4, tmp5;
|
||||
INT32 tmp1, tmp3, tmp11, tmp13;
|
||||
INT32 z1, z2, z3;
|
||||
JSAMPROW elemptr;
|
||||
int ctr;
|
||||
SHIFT_TEMPS
|
||||
|
||||
/* Pre-zero output coefficient block. */
|
||||
MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2);
|
||||
|
||||
/* Pass 1: process rows.
|
||||
* Note results are scaled up by sqrt(8) compared to a true DCT;
|
||||
* furthermore, we scale the results by 2**PASS1_BITS.
|
||||
* We must also scale the output by (8/4)*(8/2) = 2**3, which we add here.
|
||||
* Note results are scaled up by sqrt(8) compared to a true DCT.
|
||||
* 4-point FDCT kernel,
|
||||
* cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT].
|
||||
*/
|
||||
|
||||
dataptr = data;
|
||||
for (ctr = 0; ctr < 2; ctr++) {
|
||||
elemptr = sample_data[ctr] + start_col;
|
||||
/* Row 0 */
|
||||
elemptr = sample_data[0] + start_col;
|
||||
|
||||
/* Even part */
|
||||
/* Even part */
|
||||
|
||||
tmp0 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[3]);
|
||||
tmp1 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[2]);
|
||||
tmp4 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[3]);
|
||||
tmp5 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[2]);
|
||||
|
||||
tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]);
|
||||
tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]);
|
||||
tmp0 = tmp4 + tmp5;
|
||||
tmp2 = tmp4 - tmp5;
|
||||
|
||||
/* Apply unsigned->signed conversion. */
|
||||
dataptr[0] = (DCTELEM)
|
||||
((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+3));
|
||||
dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+3));
|
||||
/* Odd part */
|
||||
|
||||
/* Odd part */
|
||||
z2 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]);
|
||||
z3 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]);
|
||||
|
||||
tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */
|
||||
/* Add fudge factor here for final descale. */
|
||||
tmp0 += ONE << (CONST_BITS-PASS1_BITS-4);
|
||||
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
||||
/* Add fudge factor here for final descale. */
|
||||
z1 += ONE << (CONST_BITS-3-1);
|
||||
tmp1 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
||||
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
||||
|
||||
dataptr[1] = (DCTELEM)
|
||||
RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */
|
||||
CONST_BITS-PASS1_BITS-3);
|
||||
dataptr[3] = (DCTELEM)
|
||||
RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */
|
||||
CONST_BITS-PASS1_BITS-3);
|
||||
/* Row 1 */
|
||||
elemptr = sample_data[1] + start_col;
|
||||
|
||||
dataptr += DCTSIZE; /* advance pointer to next row */
|
||||
}
|
||||
/* Even part */
|
||||
|
||||
tmp4 = GETJSAMPLE(elemptr[0]) + GETJSAMPLE(elemptr[3]);
|
||||
tmp5 = GETJSAMPLE(elemptr[1]) + GETJSAMPLE(elemptr[2]);
|
||||
|
||||
tmp10 = tmp4 + tmp5;
|
||||
tmp12 = tmp4 - tmp5;
|
||||
|
||||
/* Odd part */
|
||||
|
||||
z2 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]);
|
||||
z3 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]);
|
||||
|
||||
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
||||
tmp11 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
||||
tmp13 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
||||
|
||||
/* Pass 2: process columns.
|
||||
* We remove the PASS1_BITS scaling, but leave the results scaled up
|
||||
* by an overall factor of 8.
|
||||
* We leave the results scaled up by an overall factor of 8.
|
||||
* We must also scale the output by (8/4)*(8/2) = 2**3.
|
||||
*/
|
||||
|
||||
dataptr = data;
|
||||
for (ctr = 0; ctr < 4; ctr++) {
|
||||
/* Even part */
|
||||
/* Column 0 */
|
||||
/* Apply unsigned->signed conversion. */
|
||||
data[DCTSIZE*0] = (tmp0 + tmp10 - 8 * CENTERJSAMPLE) << 3;
|
||||
data[DCTSIZE*1] = (tmp0 - tmp10) << 3;
|
||||
|
||||
/* Add fudge factor here for final descale. */
|
||||
tmp0 = dataptr[DCTSIZE*0] + (ONE << (PASS1_BITS-1));
|
||||
tmp1 = dataptr[DCTSIZE*1];
|
||||
/* Column 1 */
|
||||
data[DCTSIZE*0+1] = (DCTELEM) RIGHT_SHIFT(tmp1 + tmp11, CONST_BITS-3);
|
||||
data[DCTSIZE*1+1] = (DCTELEM) RIGHT_SHIFT(tmp1 - tmp11, CONST_BITS-3);
|
||||
|
||||
dataptr[DCTSIZE*0] = (DCTELEM) RIGHT_SHIFT(tmp0 + tmp1, PASS1_BITS);
|
||||
/* Column 2 */
|
||||
data[DCTSIZE*0+2] = (tmp2 + tmp12) << 3;
|
||||
data[DCTSIZE*1+2] = (tmp2 - tmp12) << 3;
|
||||
|
||||
/* Odd part */
|
||||
|
||||
dataptr[DCTSIZE*1] = (DCTELEM) RIGHT_SHIFT(tmp0 - tmp1, PASS1_BITS);
|
||||
|
||||
dataptr++; /* advance pointer to next column */
|
||||
}
|
||||
/* Column 3 */
|
||||
data[DCTSIZE*0+3] = (DCTELEM) RIGHT_SHIFT(tmp3 + tmp13, CONST_BITS-3);
|
||||
data[DCTSIZE*1+3] = (DCTELEM) RIGHT_SHIFT(tmp3 - tmp13, CONST_BITS-3);
|
||||
}
|
||||
|
||||
|
||||
@@ -4312,7 +4318,6 @@ jpeg_fdct_2x4 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
|
||||
|
||||
/* Pass 1: process rows.
|
||||
* Note results are scaled up by sqrt(8) compared to a true DCT.
|
||||
* We must also scale the output by (8/2)*(8/4) = 2**3, which we add here.
|
||||
*/
|
||||
|
||||
dataptr = data;
|
||||
@@ -4325,17 +4330,18 @@ jpeg_fdct_2x4 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
|
||||
tmp1 = GETJSAMPLE(elemptr[1]);
|
||||
|
||||
/* Apply unsigned->signed conversion. */
|
||||
dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 3);
|
||||
dataptr[0] = (DCTELEM) (tmp0 + tmp1 - 2 * CENTERJSAMPLE);
|
||||
|
||||
/* Odd part */
|
||||
|
||||
dataptr[1] = (DCTELEM) ((tmp0 - tmp1) << 3);
|
||||
dataptr[1] = (DCTELEM) (tmp0 - tmp1);
|
||||
|
||||
dataptr += DCTSIZE; /* advance pointer to next row */
|
||||
}
|
||||
|
||||
/* Pass 2: process columns.
|
||||
* We leave the results scaled up by an overall factor of 8.
|
||||
* We must also scale the output by (8/2)*(8/4) = 2**3.
|
||||
* 4-point FDCT kernel,
|
||||
* cK represents sqrt(2) * cos(K*pi/16) [refers to 8-point FDCT].
|
||||
*/
|
||||
@@ -4350,21 +4356,21 @@ jpeg_fdct_2x4 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col)
|
||||
tmp10 = dataptr[DCTSIZE*0] - dataptr[DCTSIZE*3];
|
||||
tmp11 = dataptr[DCTSIZE*1] - dataptr[DCTSIZE*2];
|
||||
|
||||
dataptr[DCTSIZE*0] = (DCTELEM) (tmp0 + tmp1);
|
||||
dataptr[DCTSIZE*2] = (DCTELEM) (tmp0 - tmp1);
|
||||
dataptr[DCTSIZE*0] = (DCTELEM) ((tmp0 + tmp1) << 3);
|
||||
dataptr[DCTSIZE*2] = (DCTELEM) ((tmp0 - tmp1) << 3);
|
||||
|
||||
/* Odd part */
|
||||
|
||||
tmp0 = MULTIPLY(tmp10 + tmp11, FIX_0_541196100); /* c6 */
|
||||
/* Add fudge factor here for final descale. */
|
||||
tmp0 += ONE << (CONST_BITS-1);
|
||||
tmp0 += ONE << (CONST_BITS-3-1);
|
||||
|
||||
dataptr[DCTSIZE*1] = (DCTELEM)
|
||||
RIGHT_SHIFT(tmp0 + MULTIPLY(tmp10, FIX_0_765366865), /* c2-c6 */
|
||||
CONST_BITS);
|
||||
CONST_BITS-3);
|
||||
dataptr[DCTSIZE*3] = (DCTELEM)
|
||||
RIGHT_SHIFT(tmp0 - MULTIPLY(tmp11, FIX_1_847759065), /* c2+c6 */
|
||||
CONST_BITS);
|
||||
CONST_BITS-3);
|
||||
|
||||
dataptr++; /* advance pointer to next column */
|
||||
}
|
||||
|
||||
Vendored
+6
-6
@@ -2,7 +2,7 @@
|
||||
* jidctint.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modification developed 2002-2016 by Guido Vollbeding.
|
||||
* Modification developed 2002-2018 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -1474,7 +1474,7 @@ jpeg_idct_10x10 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||
* producing a 11x11 output block.
|
||||
* producing an 11x11 output block.
|
||||
*
|
||||
* Optimized algorithm with 24 multiplications in the 1-D kernel.
|
||||
* cK represents sqrt(2) * cos(K*pi/22).
|
||||
@@ -3675,7 +3675,7 @@ jpeg_idct_10x5 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||
* producing a 8x4 output block.
|
||||
* producing an 8x4 output block.
|
||||
*
|
||||
* 4-point IDCT in pass 1 (columns), 8-point in pass 2 (rows).
|
||||
*/
|
||||
@@ -3835,7 +3835,7 @@ jpeg_idct_8x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||
* producing a reduced-size 6x3 output block.
|
||||
* producing a 6x3 output block.
|
||||
*
|
||||
* 3-point IDCT in pass 1 (columns), 6-point in pass 2 (rows).
|
||||
*/
|
||||
@@ -4082,7 +4082,7 @@ jpeg_idct_2x1 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||
* producing a 8x16 output block.
|
||||
* producing an 8x16 output block.
|
||||
*
|
||||
* 16-point IDCT in pass 1 (columns), 8-point in pass 2 (rows).
|
||||
*/
|
||||
@@ -5004,7 +5004,7 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||
* producing a reduced-size 3x6 output block.
|
||||
* producing a 3x6 output block.
|
||||
*
|
||||
* 6-point IDCT in pass 1 (columns), 3-point in pass 2 (rows).
|
||||
*/
|
||||
|
||||
Vendored
+28
-32
@@ -2,7 +2,7 @@
|
||||
* jmemmgr.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2011-2012 by Guido Vollbeding.
|
||||
* Modified 2011-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -130,7 +130,7 @@ typedef struct {
|
||||
jvirt_barray_ptr virt_barray_list;
|
||||
|
||||
/* This counts total space obtained from jpeg_get_small/large */
|
||||
long total_space_allocated;
|
||||
size_t total_space_allocated;
|
||||
|
||||
/* alloc_sarray and alloc_barray set this value for use by virtual
|
||||
* array routines.
|
||||
@@ -195,7 +195,7 @@ print_mem_stats (j_common_ptr cinfo, int pool_id)
|
||||
* This is helpful because message parm array can't handle longs.
|
||||
*/
|
||||
fprintf(stderr, "Freeing pool %d, total space = %ld\n",
|
||||
pool_id, mem->total_space_allocated);
|
||||
pool_id, (long) mem->total_space_allocated);
|
||||
|
||||
for (lhdr_ptr = mem->large_list[pool_id]; lhdr_ptr != NULL;
|
||||
lhdr_ptr = lhdr_ptr->hdr.next) {
|
||||
@@ -260,11 +260,11 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
|
||||
{
|
||||
my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
|
||||
small_pool_ptr hdr_ptr, prev_hdr_ptr;
|
||||
char * data_ptr;
|
||||
size_t odd_bytes, min_request, slop;
|
||||
char * data_ptr;
|
||||
|
||||
/* Check for unsatisfiable request (do now to ensure no overflow below) */
|
||||
if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(small_pool_hdr)))
|
||||
if (sizeofobject > (size_t) MAX_ALLOC_CHUNK - SIZEOF(small_pool_hdr))
|
||||
out_of_memory(cinfo, 1); /* request exceeds malloc's ability */
|
||||
|
||||
/* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
|
||||
@@ -293,8 +293,8 @@ alloc_small (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
|
||||
else
|
||||
slop = extra_pool_slop[pool_id];
|
||||
/* Don't ask for more than MAX_ALLOC_CHUNK */
|
||||
if (slop > (size_t) (MAX_ALLOC_CHUNK-min_request))
|
||||
slop = (size_t) (MAX_ALLOC_CHUNK-min_request);
|
||||
if (slop > (size_t) MAX_ALLOC_CHUNK - min_request)
|
||||
slop = (size_t) MAX_ALLOC_CHUNK - min_request;
|
||||
/* Try to get space, if fail reduce slop and try again */
|
||||
for (;;) {
|
||||
hdr_ptr = (small_pool_ptr) jpeg_get_small(cinfo, min_request + slop);
|
||||
@@ -348,7 +348,7 @@ alloc_large (j_common_ptr cinfo, int pool_id, size_t sizeofobject)
|
||||
size_t odd_bytes;
|
||||
|
||||
/* Check for unsatisfiable request (do now to ensure no overflow below) */
|
||||
if (sizeofobject > (size_t) (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)))
|
||||
if (sizeofobject > (size_t) MAX_ALLOC_CHUNK - SIZEOF(large_pool_hdr))
|
||||
out_of_memory(cinfo, 3); /* request exceeds malloc's ability */
|
||||
|
||||
/* Round up the requested size to a multiple of SIZEOF(ALIGN_TYPE) */
|
||||
@@ -404,7 +404,7 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
|
||||
long ltemp;
|
||||
|
||||
/* Calculate max # of rows allowed in one allocation chunk */
|
||||
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
|
||||
ltemp = (MAX_ALLOC_CHUNK - SIZEOF(large_pool_hdr)) /
|
||||
((long) samplesperrow * SIZEOF(JSAMPLE));
|
||||
if (ltemp <= 0)
|
||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||
@@ -416,15 +416,14 @@ alloc_sarray (j_common_ptr cinfo, int pool_id,
|
||||
|
||||
/* Get space for row pointers (small object) */
|
||||
result = (JSAMPARRAY) alloc_small(cinfo, pool_id,
|
||||
(size_t) (numrows * SIZEOF(JSAMPROW)));
|
||||
(size_t) numrows * SIZEOF(JSAMPROW));
|
||||
|
||||
/* Get the rows themselves (large objects) */
|
||||
currow = 0;
|
||||
while (currow < numrows) {
|
||||
rowsperchunk = MIN(rowsperchunk, numrows - currow);
|
||||
workspace = (JSAMPROW) alloc_large(cinfo, pool_id,
|
||||
(size_t) ((size_t) rowsperchunk * (size_t) samplesperrow
|
||||
* SIZEOF(JSAMPLE)));
|
||||
(size_t) rowsperchunk * (size_t) samplesperrow * SIZEOF(JSAMPLE));
|
||||
for (i = rowsperchunk; i > 0; i--) {
|
||||
result[currow++] = workspace;
|
||||
workspace += samplesperrow;
|
||||
@@ -452,7 +451,7 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
|
||||
long ltemp;
|
||||
|
||||
/* Calculate max # of rows allowed in one allocation chunk */
|
||||
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
|
||||
ltemp = (MAX_ALLOC_CHUNK - SIZEOF(large_pool_hdr)) /
|
||||
((long) blocksperrow * SIZEOF(JBLOCK));
|
||||
if (ltemp <= 0)
|
||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||
@@ -464,15 +463,14 @@ alloc_barray (j_common_ptr cinfo, int pool_id,
|
||||
|
||||
/* Get space for row pointers (small object) */
|
||||
result = (JBLOCKARRAY) alloc_small(cinfo, pool_id,
|
||||
(size_t) (numrows * SIZEOF(JBLOCKROW)));
|
||||
(size_t) numrows * SIZEOF(JBLOCKROW));
|
||||
|
||||
/* Get the rows themselves (large objects) */
|
||||
currow = 0;
|
||||
while (currow < numrows) {
|
||||
rowsperchunk = MIN(rowsperchunk, numrows - currow);
|
||||
workspace = (JBLOCKROW) alloc_large(cinfo, pool_id,
|
||||
(size_t) ((size_t) rowsperchunk * (size_t) blocksperrow
|
||||
* SIZEOF(JBLOCK)));
|
||||
(size_t) rowsperchunk * (size_t) blocksperrow * SIZEOF(JBLOCK));
|
||||
for (i = rowsperchunk; i > 0; i--) {
|
||||
result[currow++] = workspace;
|
||||
workspace += blocksperrow;
|
||||
@@ -585,8 +583,8 @@ realize_virt_arrays (j_common_ptr cinfo)
|
||||
/* Allocate the in-memory buffers for any unrealized virtual arrays */
|
||||
{
|
||||
my_mem_ptr mem = (my_mem_ptr) cinfo->mem;
|
||||
long space_per_minheight, maximum_space, avail_mem;
|
||||
long minheights, max_minheights;
|
||||
long bytesperrow, space_per_minheight, maximum_space;
|
||||
long avail_mem, minheights, max_minheights;
|
||||
jvirt_sarray_ptr sptr;
|
||||
jvirt_barray_ptr bptr;
|
||||
|
||||
@@ -598,18 +596,16 @@ realize_virt_arrays (j_common_ptr cinfo)
|
||||
maximum_space = 0;
|
||||
for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
|
||||
if (sptr->mem_buffer == NULL) { /* if not realized yet */
|
||||
space_per_minheight += (long) sptr->maxaccess *
|
||||
(long) sptr->samplesperrow * SIZEOF(JSAMPLE);
|
||||
maximum_space += (long) sptr->rows_in_array *
|
||||
(long) sptr->samplesperrow * SIZEOF(JSAMPLE);
|
||||
bytesperrow = (long) sptr->samplesperrow * SIZEOF(JSAMPLE);
|
||||
space_per_minheight += (long) sptr->maxaccess * bytesperrow;
|
||||
maximum_space += (long) sptr->rows_in_array * bytesperrow;
|
||||
}
|
||||
}
|
||||
for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
|
||||
if (bptr->mem_buffer == NULL) { /* if not realized yet */
|
||||
space_per_minheight += (long) bptr->maxaccess *
|
||||
(long) bptr->blocksperrow * SIZEOF(JBLOCK);
|
||||
maximum_space += (long) bptr->rows_in_array *
|
||||
(long) bptr->blocksperrow * SIZEOF(JBLOCK);
|
||||
bytesperrow = (long) bptr->blocksperrow * SIZEOF(JBLOCK);
|
||||
space_per_minheight += (long) bptr->maxaccess * bytesperrow;
|
||||
maximum_space += (long) bptr->rows_in_array * bytesperrow;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,7 +614,7 @@ realize_virt_arrays (j_common_ptr cinfo)
|
||||
|
||||
/* Determine amount of memory to actually use; this is system-dependent. */
|
||||
avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
|
||||
mem->total_space_allocated);
|
||||
(long) mem->total_space_allocated);
|
||||
|
||||
/* If the maximum space needed is available, make all the buffers full
|
||||
* height; otherwise parcel it out with the same number of minheights
|
||||
@@ -694,7 +690,7 @@ do_sarray_io (j_common_ptr cinfo, jvirt_sarray_ptr ptr, boolean writing)
|
||||
long bytesperrow, file_offset, byte_count, rows, thisrow, i;
|
||||
|
||||
bytesperrow = (long) ptr->samplesperrow * SIZEOF(JSAMPLE);
|
||||
file_offset = ptr->cur_start_row * bytesperrow;
|
||||
file_offset = (long) ptr->cur_start_row * bytesperrow;
|
||||
/* Loop to read or write each allocation chunk in mem_buffer */
|
||||
for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
|
||||
/* One chunk, but check for short chunk at end of buffer */
|
||||
@@ -727,7 +723,7 @@ do_barray_io (j_common_ptr cinfo, jvirt_barray_ptr ptr, boolean writing)
|
||||
long bytesperrow, file_offset, byte_count, rows, thisrow, i;
|
||||
|
||||
bytesperrow = (long) ptr->blocksperrow * SIZEOF(JBLOCK);
|
||||
file_offset = ptr->cur_start_row * bytesperrow;
|
||||
file_offset = (long) ptr->cur_start_row * bytesperrow;
|
||||
/* Loop to read or write each allocation chunk in mem_buffer */
|
||||
for (i = 0; i < (long) ptr->rows_in_mem; i += ptr->rowsperchunk) {
|
||||
/* One chunk, but check for short chunk at end of buffer */
|
||||
@@ -771,7 +767,7 @@ access_virt_sarray (j_common_ptr cinfo, jvirt_sarray_ptr ptr,
|
||||
|
||||
/* Make the desired part of the virtual array accessible */
|
||||
if (start_row < ptr->cur_start_row ||
|
||||
end_row > ptr->cur_start_row+ptr->rows_in_mem) {
|
||||
end_row > ptr->cur_start_row + ptr->rows_in_mem) {
|
||||
if (! ptr->b_s_open)
|
||||
ERREXIT(cinfo, JERR_VIRTUAL_BUG);
|
||||
/* Flush old buffer contents if necessary */
|
||||
@@ -856,7 +852,7 @@ access_virt_barray (j_common_ptr cinfo, jvirt_barray_ptr ptr,
|
||||
|
||||
/* Make the desired part of the virtual array accessible */
|
||||
if (start_row < ptr->cur_start_row ||
|
||||
end_row > ptr->cur_start_row+ptr->rows_in_mem) {
|
||||
end_row > ptr->cur_start_row + ptr->rows_in_mem) {
|
||||
if (! ptr->b_s_open)
|
||||
ERREXIT(cinfo, JERR_VIRTUAL_BUG);
|
||||
/* Flush old buffer contents if necessary */
|
||||
@@ -1093,7 +1089,7 @@ jinit_memory_mgr (j_common_ptr cinfo)
|
||||
mem->total_space_allocated = SIZEOF(my_memory_mgr);
|
||||
|
||||
/* Declare ourselves open for business */
|
||||
cinfo->mem = & mem->pub;
|
||||
cinfo->mem = &mem->pub;
|
||||
|
||||
/* Check for an environment variable JPEGMEM; if found, override the
|
||||
* default max_memory setting from jpeg_mem_init. Note that the
|
||||
|
||||
Vendored
+6
-2
@@ -2,6 +2,7 @@
|
||||
* jmemnobs.c
|
||||
*
|
||||
* Copyright (C) 1992-1996, Thomas G. Lane.
|
||||
* Modified 2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -12,7 +13,7 @@
|
||||
* This is very portable in the sense that it'll compile on almost anything,
|
||||
* but you'd better have lots of main memory (or virtual memory) if you want
|
||||
* to process big images.
|
||||
* Note that the max_memory_to_use option is ignored by this implementation.
|
||||
* Note that the max_memory_to_use option is respected by this implementation.
|
||||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
@@ -66,13 +67,16 @@ jpeg_free_large (j_common_ptr cinfo, void FAR * object, size_t sizeofobject)
|
||||
|
||||
/*
|
||||
* This routine computes the total memory space available for allocation.
|
||||
* Here we always say, "we got all you want bud!"
|
||||
*/
|
||||
|
||||
GLOBAL(long)
|
||||
jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed,
|
||||
long max_bytes_needed, long already_allocated)
|
||||
{
|
||||
if (cinfo->mem->max_memory_to_use)
|
||||
return cinfo->mem->max_memory_to_use - already_allocated;
|
||||
|
||||
/* Here we say, "we got all you want bud!" */
|
||||
return max_bytes_needed;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
-1
@@ -2,7 +2,7 @@
|
||||
* jpegint.h
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2017 by Guido Vollbeding.
|
||||
* Modified 1997-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -302,6 +302,13 @@ struct jpeg_color_quantizer {
|
||||
#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
|
||||
#endif
|
||||
|
||||
/* Descale and correctly round an INT32 value that's scaled by N bits.
|
||||
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
|
||||
* the fudge factor is correct for either sign of X.
|
||||
*/
|
||||
|
||||
#define DESCALE(x,n) RIGHT_SHIFT((x) + ((INT32) 1 << ((n)-1)), n)
|
||||
|
||||
|
||||
/* Short forms of external names for systems with brain-damaged linkers. */
|
||||
|
||||
|
||||
Vendored
+7
-4
@@ -2,7 +2,7 @@
|
||||
* jpeglib.h
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2017 by Guido Vollbeding.
|
||||
* Modified 2002-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
|
||||
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
||||
#define JPEG_LIB_VERSION_MAJOR 9
|
||||
#define JPEG_LIB_VERSION_MINOR 3
|
||||
#define JPEG_LIB_VERSION_MINOR 4
|
||||
|
||||
|
||||
/* Various constants determining the sizes of things.
|
||||
@@ -909,6 +909,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_suppress_tables jSuppressTables
|
||||
#define jpeg_alloc_quant_table jAlcQTable
|
||||
#define jpeg_alloc_huff_table jAlcHTable
|
||||
#define jpeg_std_huff_table jStdHTable
|
||||
#define jpeg_start_compress jStrtCompress
|
||||
#define jpeg_write_scanlines jWrtScanlines
|
||||
#define jpeg_finish_compress jFinCompress
|
||||
@@ -977,10 +978,10 @@ EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
|
||||
/* Data source and destination managers: memory buffers. */
|
||||
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
|
||||
unsigned char ** outbuffer,
|
||||
unsigned long * outsize));
|
||||
size_t * outsize));
|
||||
EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
|
||||
const unsigned char * inbuffer,
|
||||
unsigned long insize));
|
||||
size_t insize));
|
||||
|
||||
/* Default parameter setup for compression */
|
||||
EXTERN(void) jpeg_set_defaults JPP((j_compress_ptr cinfo));
|
||||
@@ -1005,6 +1006,8 @@ EXTERN(void) jpeg_suppress_tables JPP((j_compress_ptr cinfo,
|
||||
boolean suppress));
|
||||
EXTERN(JQUANT_TBL *) jpeg_alloc_quant_table JPP((j_common_ptr cinfo));
|
||||
EXTERN(JHUFF_TBL *) jpeg_alloc_huff_table JPP((j_common_ptr cinfo));
|
||||
EXTERN(JHUFF_TBL *) jpeg_std_huff_table JPP((j_common_ptr cinfo,
|
||||
boolean isDC, int tblno));
|
||||
|
||||
/* Main entry points for compression */
|
||||
EXTERN(void) jpeg_start_compress JPP((j_compress_ptr cinfo,
|
||||
|
||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
||||
* jutils.c
|
||||
*
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modified 2009-2011 by Guido Vollbeding.
|
||||
* Modified 2009-2019 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -185,7 +185,7 @@ jcopy_sample_rows (JSAMPARRAY input_array, int source_row,
|
||||
{
|
||||
register JSAMPROW inptr, outptr;
|
||||
#ifdef FMEMCOPY
|
||||
register size_t count = (size_t) (num_cols * SIZEOF(JSAMPLE));
|
||||
register size_t count = (size_t) num_cols * SIZEOF(JSAMPLE);
|
||||
#else
|
||||
register JDIMENSION count;
|
||||
#endif
|
||||
@@ -213,7 +213,7 @@ jcopy_block_row (JBLOCKROW input_row, JBLOCKROW output_row,
|
||||
/* Copy a row of coefficient blocks from one place to another. */
|
||||
{
|
||||
#ifdef FMEMCOPY
|
||||
FMEMCOPY(output_row, input_row, num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));
|
||||
FMEMCOPY(output_row, input_row, (size_t) num_blocks * (DCTSIZE2 * SIZEOF(JCOEF)));
|
||||
#else
|
||||
register JCOEFPTR inptr, outptr;
|
||||
register long count;
|
||||
|
||||
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jversion.h
|
||||
*
|
||||
* Copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
||||
* Copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -9,6 +9,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#define JVERSION "9c 14-Jan-2018"
|
||||
#define JVERSION "9d 12-Jan-2020"
|
||||
|
||||
#define JCOPYRIGHT "Copyright (C) 2018, Thomas G. Lane, Guido Vollbeding"
|
||||
#define JCOPYRIGHT "Copyright (C) 2020, Thomas G. Lane, Guido Vollbeding"
|
||||
|
||||
Vendored
+2
-2
@@ -74,7 +74,7 @@ if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
endif(MSVC)
|
||||
|
||||
add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
||||
add_library(${PNG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs})
|
||||
target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wcast-align -Wimplicit-fallthrough -Wunused-parameter -Wsign-compare)
|
||||
@@ -92,7 +92,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${PNG_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(libpng LICENSE README)
|
||||
|
||||
Vendored
+9
-20
@@ -20,9 +20,8 @@
|
||||
# Author: qtang@openailab.com or https://github.com/BUG1989
|
||||
# qli@openailab.com
|
||||
# sqfu@openailab.com
|
||||
#
|
||||
|
||||
SET(TENGINE_COMMIT_VERSION "2f3cd86217f3530c8e4a82f3ed5af14c7a4e3943")
|
||||
SET(TENGINE_COMMIT_VERSION "e89cf8870de2ff0a80cfe626c0b52b2a16fb302e")
|
||||
SET(OCV_TENGINE_DIR "${OpenCV_BINARY_DIR}/3rdparty/libtengine")
|
||||
SET(OCV_TENGINE_SOURCE_PATH "${OCV_TENGINE_DIR}/Tengine-${TENGINE_COMMIT_VERSION}")
|
||||
|
||||
@@ -32,11 +31,10 @@ IF(EXISTS "${OCV_TENGINE_SOURCE_PATH}")
|
||||
SET(Tengine_FOUND ON)
|
||||
SET(BUILD_TENGINE ON)
|
||||
ELSE()
|
||||
SET(OCV_TENGINE_FILENAME "${TENGINE_COMMIT_VERSION}.zip")#name2
|
||||
SET(OCV_TENGINE_URL "https://github.com/OAID/Tengine/archive/") #url2
|
||||
SET(tengine_md5sum 9124324b6e2b350012e46ae1db4bad7d) #md5sum2
|
||||
SET(OCV_TENGINE_FILENAME "${TENGINE_COMMIT_VERSION}.zip")#name
|
||||
SET(OCV_TENGINE_URL "https://github.com/OAID/Tengine/archive/") #url
|
||||
SET(tengine_md5sum 23f61ebb1dd419f1207d8876496289c5) #md5sum
|
||||
|
||||
#MESSAGE(STATUS "**** TENGINE DOWNLOAD BEGIN ****")
|
||||
ocv_download(FILENAME ${OCV_TENGINE_FILENAME}
|
||||
HASH ${tengine_md5sum}
|
||||
URL
|
||||
@@ -62,30 +60,21 @@ ENDIF()
|
||||
if(BUILD_TENGINE)
|
||||
SET(HAVE_TENGINE 1)
|
||||
|
||||
# android system
|
||||
if(ANDROID)
|
||||
if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
|
||||
SET(CONFIG_ARCH_ARM32 ON)
|
||||
elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
|
||||
SET(CONFIG_ARCH_ARM64 ON)
|
||||
endif()
|
||||
SET(Tengine_LIB "tengine" CACHE INTERNAL "")
|
||||
else()
|
||||
if(NOT ANDROID)
|
||||
# linux system
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
|
||||
SET(CONFIG_ARCH_ARM32 ON)
|
||||
SET(TENGINE_TOOLCHAIN_FLAG "-march=armv7-a")
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64) ## AARCH64
|
||||
SET(CONFIG_ARCH_ARM64 ON)
|
||||
SET(TENGINE_TOOLCHAIN_FLAG "-march=armv8-a")
|
||||
endif()
|
||||
SET(Tengine_LIB "tengine" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
SET(BUILT_IN_OPENCV ON) ## set for tengine compile discern .
|
||||
SET(Tengine_INCLUDE_DIR "${OCV_TENGINE_SOURCE_PATH}/core/include" CACHE INTERNAL "")
|
||||
SET(Tengine_INCLUDE_DIR "${OCV_TENGINE_SOURCE_PATH}/include" CACHE INTERNAL "")
|
||||
if(EXISTS "${OCV_TENGINE_SOURCE_PATH}/CMakeLists.txt")
|
||||
add_subdirectory("${OCV_TENGINE_SOURCE_PATH}" "${OCV_TENGINE_DIR}/build")
|
||||
else()
|
||||
message(WARNING "TENGINE: Missing 'CMakeLists.txt' in source code package: ${OCV_TENGINE_SOURCE_PATH}")
|
||||
SET(HAVE_TENGINE 1)
|
||||
endif()
|
||||
SET(Tengine_LIB "tengine" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
Vendored
+2
-2
@@ -462,7 +462,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4456 /wd4457 /wd4312) # vs2015
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4267 /wd4244 /wd4018 /wd4311 /wd4312)
|
||||
|
||||
add_library(${TIFF_LIBRARY} STATIC ${lib_srcs})
|
||||
add_library(${TIFF_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs})
|
||||
target_link_libraries(${TIFF_LIBRARY} ${ZLIB_LIBRARIES})
|
||||
|
||||
set_target_properties(${TIFF_LIBRARY}
|
||||
@@ -479,7 +479,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${TIFF_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(libtiff COPYRIGHT)
|
||||
|
||||
Vendored
+2
-2
@@ -34,7 +34,7 @@ endif()
|
||||
|
||||
add_definitions(-DWEBP_USE_THREAD)
|
||||
|
||||
add_library(${WEBP_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs})
|
||||
add_library(${WEBP_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs})
|
||||
if(ANDROID)
|
||||
target_link_libraries(${WEBP_LIBRARY} ${CPUFEATURES_LIBRARIES})
|
||||
endif()
|
||||
@@ -59,6 +59,6 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${WEBP_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(${WEBP_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -125,7 +125,7 @@ if(MSVC AND CV_ICC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qrestrict")
|
||||
endif()
|
||||
|
||||
add_library(IlmImf STATIC ${lib_hdrs} ${lib_srcs})
|
||||
add_library(IlmImf STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_hdrs} ${lib_srcs})
|
||||
target_link_libraries(IlmImf ${ZLIB_LIBRARIES})
|
||||
|
||||
set_target_properties(IlmImf
|
||||
@@ -142,7 +142,7 @@ if(ENABLE_SOLUTION_FOLDERS)
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
||||
ocv_install_target(IlmImf EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(openexr LICENSE AUTHORS.ilmbase AUTHORS.openexr)
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ Attribute::~Attribute () {}
|
||||
|
||||
namespace {
|
||||
|
||||
struct NameCompare: std::binary_function <const char *, const char *, bool>
|
||||
struct NameCompare
|
||||
{
|
||||
bool
|
||||
operator () (const char *x, const char *y) const
|
||||
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
# Authors of OpenJPEG
|
||||
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
|
||||
|
||||
David Janssens designed and implemented the first version of OpenJPEG.
|
||||
|
||||
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||
|
||||
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
|
||||
|
||||
Giuseppe Baruffa added the JPWL functionalities.
|
||||
|
||||
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
|
||||
|
||||
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
|
||||
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
||||
Antonin Descampe
|
||||
improved the libraries and utilities.
|
||||
|
||||
Vendored
+683
@@ -0,0 +1,683 @@
|
||||
# Changelog
|
||||
|
||||
## [v2.3.1](https://github.com/uclouvain/openjpeg/releases/v2.3.1) (2019-04-02)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.3.0...v2.3.1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- v2.2.0 regression for decoding images where TNsot == 0 [\#1120](https://github.com/uclouvain/openjpeg/issues/1120)
|
||||
- Int overflow in jp3d [\#1162](https://github.com/uclouvain/openjpeg/issues/1162)
|
||||
- Heap buffer overflow in opj\_j2k\_update\_image\_data\(\) triggered with Ghostscript [\#1157](https://github.com/uclouvain/openjpeg/issues/1157)
|
||||
- LINUX install doesn't work when building shared libraries is disabled [\#1155](https://github.com/uclouvain/openjpeg/issues/1155)
|
||||
- OPENJPEG null ptr dereference in openjpeg-2.3.0/src/bin/jp2/convert.c:2243 [\#1152](https://github.com/uclouvain/openjpeg/issues/1152)
|
||||
- How to drop certain subbands/layers in DWT [\#1147](https://github.com/uclouvain/openjpeg/issues/1147)
|
||||
- where is the MQ-Coder ouput stream in t2.c? [\#1146](https://github.com/uclouvain/openjpeg/issues/1146)
|
||||
- OpenJPEG 2.3 \(and 2.2?\) multi component image fails to decode with KDU v7.10 [\#1132](https://github.com/uclouvain/openjpeg/issues/1132)
|
||||
- Missing checks for header\_info.height and header\_info.width in function pnmtoimage in src/bin/jpwl/convert.c, which can lead to heap buffer overflow [\#1126](https://github.com/uclouvain/openjpeg/issues/1126)
|
||||
- Assertion Failure in jp2.c [\#1125](https://github.com/uclouvain/openjpeg/issues/1125)
|
||||
- Division-by-zero vulnerabilities in the function pi\_next\_pcrl, pi\_next\_cprl and pi\_next\_rpcl in src/lib/openjp3d/pi.c [\#1123](https://github.com/uclouvain/openjpeg/issues/1123)
|
||||
- Precinct switch \(-c\) doesn't right-shift last record to remaining resolution levels [\#1117](https://github.com/uclouvain/openjpeg/issues/1117)
|
||||
- Sample: encode J2K a data using streams??? [\#1114](https://github.com/uclouvain/openjpeg/issues/1114)
|
||||
- HIGH THROUGHPUT JPEG 2000 \(HTJ2K\) [\#1112](https://github.com/uclouvain/openjpeg/issues/1112)
|
||||
- How to build openjpeg for arm linux? [\#1108](https://github.com/uclouvain/openjpeg/issues/1108)
|
||||
- crash [\#1106](https://github.com/uclouvain/openjpeg/issues/1106)
|
||||
- JP2000 returning OPJ\_CLRSPC\_UNKNOWN color space [\#1103](https://github.com/uclouvain/openjpeg/issues/1103)
|
||||
- Compilation successful but install unsuccessful: Calling executables throws libraries missing error [\#1102](https://github.com/uclouvain/openjpeg/issues/1102)
|
||||
- fprintf format string requires 1 parameter but only 0 are given [\#1093](https://github.com/uclouvain/openjpeg/issues/1093)
|
||||
- fprintf format string requires 1 parameter but only 0 are given [\#1092](https://github.com/uclouvain/openjpeg/issues/1092)
|
||||
- sprintf buffer overflow [\#1088](https://github.com/uclouvain/openjpeg/issues/1088)
|
||||
- sprintf buffer overflow [\#1085](https://github.com/uclouvain/openjpeg/issues/1085)
|
||||
- Infinite loop when reading jp2 [\#1081](https://github.com/uclouvain/openjpeg/issues/1081)
|
||||
- missing format string parameter [\#1074](https://github.com/uclouvain/openjpeg/issues/1074)
|
||||
- Excessive Iteration in opj\_t1\_encode\_cblks \(src/lib/openjp2/t1.c\) [\#1059](https://github.com/uclouvain/openjpeg/issues/1059)
|
||||
- Out-of-bound left shift in opj\_j2k\_setup\_encoder \(src/lib/openjp2/j2k.c\) [\#1057](https://github.com/uclouvain/openjpeg/issues/1057)
|
||||
- Encode image on Unsplash [\#1054](https://github.com/uclouvain/openjpeg/issues/1054)
|
||||
- Integer overflow in opj\_t1\_encode\_cblks \(src/lib/openjp2/t1.c\) [\#1053](https://github.com/uclouvain/openjpeg/issues/1053)
|
||||
- Signed Integer Overflow - 68065512 [\#1048](https://github.com/uclouvain/openjpeg/issues/1048)
|
||||
- Similar vulnerable functions related to CVE-2017-14041 [\#1044](https://github.com/uclouvain/openjpeg/issues/1044)
|
||||
- \[ERROR\] COD marker already read. No more than one COD marker per tile. [\#1043](https://github.com/uclouvain/openjpeg/issues/1043)
|
||||
- failing to install latest version of openjpeg from source [\#1041](https://github.com/uclouvain/openjpeg/issues/1041)
|
||||
- Trouble compressing large raw image [\#1032](https://github.com/uclouvain/openjpeg/issues/1032)
|
||||
- Download and installed code from 2.3 archive. Installing 2.2? [\#1030](https://github.com/uclouvain/openjpeg/issues/1030)
|
||||
- missing fclose [\#1029](https://github.com/uclouvain/openjpeg/issues/1029)
|
||||
- NULL Pointer Access in function imagetopnm of convert.c\(jp2\):1289 [\#860](https://github.com/uclouvain/openjpeg/issues/860)
|
||||
- NULL Pointer Access in function imagetopnm of convert.c:2226\(jp2\) [\#859](https://github.com/uclouvain/openjpeg/issues/859)
|
||||
- Heap Buffer Overflow in function imagetotga of convert.c\(jp2\):942 [\#858](https://github.com/uclouvain/openjpeg/issues/858)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- abi-check.sh: fix broken download URL [\#1188](https://github.com/uclouvain/openjpeg/pull/1188) ([rouault](https://github.com/rouault))
|
||||
- opj\_t1\_encode\_cblks: fix UBSAN signed integer overflow [\#1187](https://github.com/uclouvain/openjpeg/pull/1187) ([rouault](https://github.com/rouault))
|
||||
- convertbmp: detect invalid file dimensions early \(CVE-2018-6616\) [\#1172](https://github.com/uclouvain/openjpeg/pull/1172) ([hlef](https://github.com/hlef))
|
||||
- color\_apply\_icc\_profile: avoid potential heap buffer overflow [\#1170](https://github.com/uclouvain/openjpeg/pull/1170) ([rouault](https://github.com/rouault))
|
||||
- Fix multiple potential vulnerabilities and bugs [\#1168](https://github.com/uclouvain/openjpeg/pull/1168) ([Young-X](https://github.com/Young-X))
|
||||
- Fix several memory and resource leaks [\#1163](https://github.com/uclouvain/openjpeg/pull/1163) ([nforro](https://github.com/nforro))
|
||||
- Fix some potential overflow issues [\#1161](https://github.com/uclouvain/openjpeg/pull/1161) ([stweil](https://github.com/stweil))
|
||||
- jp3d/jpwl convert: fix write stack buffer overflow [\#1160](https://github.com/uclouvain/openjpeg/pull/1160) ([hlef](https://github.com/hlef))
|
||||
- Int overflow fixed [\#1159](https://github.com/uclouvain/openjpeg/pull/1159) ([ichlubna](https://github.com/ichlubna))
|
||||
- Update knownfailures- files given current configurations [\#1149](https://github.com/uclouvain/openjpeg/pull/1149) ([rouault](https://github.com/rouault))
|
||||
- CVE-2018-5785: fix issues with zero bitmasks [\#1148](https://github.com/uclouvain/openjpeg/pull/1148) ([hlef](https://github.com/hlef))
|
||||
- openjp2/jp2: Fix two format strings [\#1143](https://github.com/uclouvain/openjpeg/pull/1143) ([stweil](https://github.com/stweil))
|
||||
- Changes in pnmtoimage if image data are missing [\#1141](https://github.com/uclouvain/openjpeg/pull/1141) ([szukw000](https://github.com/szukw000))
|
||||
- Relative path to header files is hardcoded in OpenJPEGConfig.cmake.in file [\#1140](https://github.com/uclouvain/openjpeg/pull/1140) ([bukatlib](https://github.com/bukatlib))
|
||||
- Cast on uint ceildiv [\#1136](https://github.com/uclouvain/openjpeg/pull/1136) ([reverson](https://github.com/reverson))
|
||||
- Add -DBUILD\_PKGCONFIG\_FILES to install instructions [\#1133](https://github.com/uclouvain/openjpeg/pull/1133) ([robe2](https://github.com/robe2))
|
||||
- Fix some typos in code comments and documentation [\#1128](https://github.com/uclouvain/openjpeg/pull/1128) ([stweil](https://github.com/stweil))
|
||||
- Fix regression in reading files with TNsot == 0 \(refs \#1120\) [\#1121](https://github.com/uclouvain/openjpeg/pull/1121) ([rouault](https://github.com/rouault))
|
||||
- Use local type declaration for POSIX standard type only for MS compiler [\#1119](https://github.com/uclouvain/openjpeg/pull/1119) ([stweil](https://github.com/stweil))
|
||||
- Fix Mac builds [\#1104](https://github.com/uclouvain/openjpeg/pull/1104) ([rouault](https://github.com/rouault))
|
||||
- jp3d: Replace sprintf\(\) by snprintf\(\) in volumetobin\(\) [\#1101](https://github.com/uclouvain/openjpeg/pull/1101) ([kbabioch](https://github.com/kbabioch))
|
||||
- opj\_mj2\_extract: Rename output\_location to output\_prefix [\#1096](https://github.com/uclouvain/openjpeg/pull/1096) ([kbabioch](https://github.com/kbabioch))
|
||||
- mj2: Add missing variable to format string in fprintf\(\) invocation in meta\_out.c [\#1094](https://github.com/uclouvain/openjpeg/pull/1094) ([kbabioch](https://github.com/kbabioch))
|
||||
- Convert files to UTF-8 encoding [\#1090](https://github.com/uclouvain/openjpeg/pull/1090) ([stweil](https://github.com/stweil))
|
||||
- fix unchecked integer multiplication overflow [\#1080](https://github.com/uclouvain/openjpeg/pull/1080) ([setharnold](https://github.com/setharnold))
|
||||
- Fixed typos [\#1062](https://github.com/uclouvain/openjpeg/pull/1062) ([radarhere](https://github.com/radarhere))
|
||||
- Note that seek uses SEEK\_SET behavior. [\#1055](https://github.com/uclouvain/openjpeg/pull/1055) ([ideasman42](https://github.com/ideasman42))
|
||||
- Some Doxygen tags are removed [\#1050](https://github.com/uclouvain/openjpeg/pull/1050) ([szukw000](https://github.com/szukw000))
|
||||
- Fix resource leak \(CID 179466\) [\#1047](https://github.com/uclouvain/openjpeg/pull/1047) ([stweil](https://github.com/stweil))
|
||||
- Changed cmake version test to allow for cmake 2.8.11.x [\#1042](https://github.com/uclouvain/openjpeg/pull/1042) ([radarhere](https://github.com/radarhere))
|
||||
- Add missing fclose\(\) statement in error condition. [\#1037](https://github.com/uclouvain/openjpeg/pull/1037) ([gfiumara](https://github.com/gfiumara))
|
||||
|
||||
## [v2.3.0](https://github.com/uclouvain/openjpeg/releases/v2.3.0) (2017-10-04)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.2.0...v2.3.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Sub-tile decoding: only decode precincts and codeblocks that intersect the window specified in opj_set_decode_area() [\#990](https://github.com/uclouvain/openjpeg/pull/990) ([rouault](https://github.com/rouault))
|
||||
- Sub-tile decoding: only apply IDWT on areas that participate to the window of interest [\#1001](https://github.com/uclouvain/openjpeg/pull/1001) ([rouault](https://github.com/rouault))
|
||||
- Sub-tile decoding: memory use reduction and perf improvements [\#1010](https://github.com/uclouvain/openjpeg/pull/1010) ([rouault](https://github.com/rouault))
|
||||
- Add capability to decode only a subset of all components of an image. [\#1022](https://github.com/uclouvain/openjpeg/pull/1022) ([rouault](https://github.com/rouault))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Setting x offset of decode region to -1 causes opj\_decompress to go into infinite loop [\#736](https://github.com/uclouvain/openjpeg/issues/736)
|
||||
- Problem decoding multiple tiles with get\_decoded\_tile when cmap/pclr/cdef boxes are present in jp2 file [\#484](https://github.com/uclouvain/openjpeg/issues/484)
|
||||
- set reduce\_factor\_may\_fail [\#474](https://github.com/uclouvain/openjpeg/issues/474)
|
||||
- opj\_compress.exe, command line parser, infinite loop [\#469](https://github.com/uclouvain/openjpeg/issues/469)
|
||||
- Various memory access issues found via fuzzing [\#448](https://github.com/uclouvain/openjpeg/issues/448)
|
||||
- Multiple warnings when building OpenJPEG \(trunk\) [\#442](https://github.com/uclouvain/openjpeg/issues/442)
|
||||
- Bulk fuzz-testing report [\#427](https://github.com/uclouvain/openjpeg/issues/427)
|
||||
- remove all printf from openjpeg / use proper function pointer for logging [\#371](https://github.com/uclouvain/openjpeg/issues/371)
|
||||
- minor changes, clean-up [\#349](https://github.com/uclouvain/openjpeg/issues/349)
|
||||
- image-\>numcomps \> 4 [\#333](https://github.com/uclouvain/openjpeg/issues/333)
|
||||
- Improve support for region of interest [\#39](https://github.com/uclouvain/openjpeg/issues/39)
|
||||
- Public function to tell kernel type used \(5x3 vs 9x7\) [\#3](https://github.com/uclouvain/openjpeg/issues/3)
|
||||
- elf binary in source package ? [\#1026](https://github.com/uclouvain/openjpeg/issues/1026)
|
||||
- opj\_cio\_open [\#1025](https://github.com/uclouvain/openjpeg/issues/1025)
|
||||
- Building with Visual Studio 2015 [\#1023](https://github.com/uclouvain/openjpeg/issues/1023)
|
||||
- tcd.cpp\>:1617:33: error: assigning to 'OPJ\_INT32 \*' \(aka 'int \*'\) from incompatible type 'void \*' [\#1021](https://github.com/uclouvain/openjpeg/issues/1021)
|
||||
- j2k.cpp \> comparison of address of 'p\_j2k-\>m\_cp.tcps\[0\].m\_data' not equal to a null pointer is always true [\#1020](https://github.com/uclouvain/openjpeg/issues/1020)
|
||||
- Openjpeg 2.2.0 always build shared library even though -DBUILD\_SHARED\_LIBS:bool=off [\#1019](https://github.com/uclouvain/openjpeg/issues/1019)
|
||||
- missing fclose [\#1018](https://github.com/uclouvain/openjpeg/issues/1018)
|
||||
- Use opj\_image\_data\_free instead of opj\_free for image-\>comps\[\].data [\#1014](https://github.com/uclouvain/openjpeg/issues/1014)
|
||||
- malloc poison on some compilers - cross compiling [\#1013](https://github.com/uclouvain/openjpeg/issues/1013)
|
||||
- Add OPJ\_VERSION\_MAJOR, OPJ\_VERSION\_MINOR, OPJ\_VERSION\_MICRO macros in openjpeg.h [\#1011](https://github.com/uclouvain/openjpeg/issues/1011)
|
||||
- Encode: do not perform rate control for single-tile lossless [\#1009](https://github.com/uclouvain/openjpeg/issues/1009)
|
||||
- opj\_set\_decoded\_resolution\_factor\(\): bad interaction with opj\_set\_decode\_area\(\) and/or opj\_decode\(\) [\#1006](https://github.com/uclouvain/openjpeg/issues/1006)
|
||||
- memory allocation failure with .pgx file [\#999](https://github.com/uclouvain/openjpeg/issues/999)
|
||||
- Unable to fuzz with raw image as input [\#998](https://github.com/uclouvain/openjpeg/issues/998)
|
||||
- stack-based buffer overflow write in pgxtoimage \(/convert.c\) [\#997](https://github.com/uclouvain/openjpeg/issues/997)
|
||||
- freeze with a crafted bmp [\#996](https://github.com/uclouvain/openjpeg/issues/996)
|
||||
- invalid memory write in tgatoimage \(convert.c\) [\#995](https://github.com/uclouvain/openjpeg/issues/995)
|
||||
- static build on Windows fails [\#994](https://github.com/uclouvain/openjpeg/issues/994)
|
||||
- another heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#993](https://github.com/uclouvain/openjpeg/issues/993)
|
||||
- heap-based buffer overflow in opj\_t2\_encode\_packet \(t2.c\) [\#992](https://github.com/uclouvain/openjpeg/issues/992)
|
||||
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) \(unfixed \#985\) [\#991](https://github.com/uclouvain/openjpeg/issues/991)
|
||||
- heap overflow in opj\_compress [\#988](https://github.com/uclouvain/openjpeg/issues/988)
|
||||
- heap overflow in opj\_decompress [\#987](https://github.com/uclouvain/openjpeg/issues/987)
|
||||
- heap-based buffer overflow in opj\_bio\_byteout \(bio.c\) [\#986](https://github.com/uclouvain/openjpeg/issues/986)
|
||||
- heap-based buffer overflow in opj\_write\_bytes\_LE \(cio.c\) [\#985](https://github.com/uclouvain/openjpeg/issues/985)
|
||||
- memory allocation failure in opj\_aligned\_alloc\_n \(opj\_malloc.c\) [\#983](https://github.com/uclouvain/openjpeg/issues/983)
|
||||
- heap-base buffer overflow in opj\_mqc\_flush \(mqc.c\) [\#982](https://github.com/uclouvain/openjpeg/issues/982)
|
||||
- Decode fails for JP2s with ICC profile [\#981](https://github.com/uclouvain/openjpeg/issues/981)
|
||||
- Unit tests failing on Ubuntu 17.04 [\#916](https://github.com/uclouvain/openjpeg/issues/916)
|
||||
- Encoder crashes on small images [\#901](https://github.com/uclouvain/openjpeg/issues/901)
|
||||
- openjpeg-1.5.3 fails to compile [\#830](https://github.com/uclouvain/openjpeg/issues/830)
|
||||
- opj\_compress crops image \(win\) or creates a jp2 which cannot be decompressed \(lin\) [\#716](https://github.com/uclouvain/openjpeg/issues/716)
|
||||
- -d flag is silently ignored when decoding a single tile [\#693](https://github.com/uclouvain/openjpeg/issues/693)
|
||||
- transition away from dev-utils [\#628](https://github.com/uclouvain/openjpeg/issues/628)
|
||||
- update instructions to build with Visual Studio and 64-Bit Visual C++ Toolset. [\#1028](https://github.com/uclouvain/openjpeg/pull/1028) ([quangnh89](https://github.com/quangnh89))
|
||||
- Add missing newline at end of file [\#1024](https://github.com/uclouvain/openjpeg/pull/1024) ([stweil](https://github.com/stweil))
|
||||
- merge master into coverity\_scan to update coverity results [\#1008](https://github.com/uclouvain/openjpeg/pull/1008) ([detonin](https://github.com/detonin))
|
||||
- Use more const qualifiers [\#984](https://github.com/uclouvain/openjpeg/pull/984) ([stweil](https://github.com/stweil))
|
||||
- Changes in converttif.c for PPC64 [\#980](https://github.com/uclouvain/openjpeg/pull/980) ([szukw000](https://github.com/szukw000))
|
||||
|
||||
## [v2.2.0](https://github.com/uclouvain/openjpeg/releases/v2.2.0) (2017-08-10)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.2...v2.2.0)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- Memory consumption reduction at decoding side [\#968](https://github.com/uclouvain/openjpeg/pull/968) ([rouault](https://github.com/rouault))
|
||||
- T1 & DWT multithreading decoding optimizations [\#786](https://github.com/uclouvain/openjpeg/pull/786) ([rouault](https://github.com/rouault))
|
||||
- Tier1 decoder speed optimizations [\#783](https://github.com/uclouvain/openjpeg/pull/783) ([rouault](https://github.com/rouault))
|
||||
- Inverse DWT 5x3: lift implementation / SSE accelerated version [\#953](https://github.com/uclouvain/openjpeg/issues/953)
|
||||
- install static libraries [\#969](https://github.com/uclouvain/openjpeg/pull/969) ([jeroen](https://github.com/jeroen))
|
||||
- IDWT 5x3 single-pass lifting and SSE2/AVX2 implementation [\#957](https://github.com/uclouvain/openjpeg/pull/957) ([rouault](https://github.com/rouault))
|
||||
- build both shared and static library [\#954](https://github.com/uclouvain/openjpeg/pull/954) ([jeroen](https://github.com/jeroen))
|
||||
- T1 flag optimizations \(\#172\) [\#945](https://github.com/uclouvain/openjpeg/pull/945) ([rouault](https://github.com/rouault))
|
||||
- CMake: add stronger warnings for openjp2 lib/bin by default, and error out on declaration-after-statement [\#936](https://github.com/uclouvain/openjpeg/pull/936) ([rouault](https://github.com/rouault))
|
||||
- Quiet mode for opj\_decompress via -quiet long parameter. [\#928](https://github.com/uclouvain/openjpeg/pull/928) ([RussellMcOrmond](https://github.com/RussellMcOrmond))
|
||||
- Implement predictive termination check [\#800](https://github.com/uclouvain/openjpeg/pull/800) ([rouault](https://github.com/rouault))
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Several issues spotted by Google OSS Fuzz - [see here](https://github.com/search?l=&q=OSS+Fuzz+author-date%3A2017-07-04..2017-08-01+repo%3Auclouvain%2Fopenjpeg&ref=advsearch&type=Commits&utf8=%E2%9C%93)
|
||||
- Missing fclose [\#976](https://github.com/uclouvain/openjpeg/issues/976)
|
||||
- Heap buffer overflow read in openjpeg imagetopnm [\#970](https://github.com/uclouvain/openjpeg/issues/970)
|
||||
- opj\_decompress opj\_j2k\_update\_image\_data\(\) Segment falut [\#948](https://github.com/uclouvain/openjpeg/issues/948)
|
||||
- Generic Crash in 1.5.0 [\#941](https://github.com/uclouvain/openjpeg/issues/941)
|
||||
- Segmentation Faults [\#940](https://github.com/uclouvain/openjpeg/issues/940)
|
||||
- Assertions thrown [\#939](https://github.com/uclouvain/openjpeg/issues/939)
|
||||
- Floating Point Errors [\#938](https://github.com/uclouvain/openjpeg/issues/938)
|
||||
- Division by zero crash [\#937](https://github.com/uclouvain/openjpeg/issues/937)
|
||||
- malformed jp2 can cause heap-buffer-overflow [\#909](https://github.com/uclouvain/openjpeg/issues/909)
|
||||
- NULL dereference can cause by malformed file [\#908](https://github.com/uclouvain/openjpeg/issues/908)
|
||||
- Out of bound read in opj\_j2k\_add\_mct [\#907](https://github.com/uclouvain/openjpeg/issues/907)
|
||||
- Check bpno\_plus\_one in opj\_t1\_decode\_cblk [\#903](https://github.com/uclouvain/openjpeg/issues/903)
|
||||
- Undefined-shift in opj\_j2k\_read\_siz [\#902](https://github.com/uclouvain/openjpeg/issues/902)
|
||||
- opj\_compress v2.1.2 can create images opj\_decompress cannot read [\#891](https://github.com/uclouvain/openjpeg/issues/891)
|
||||
- Improper usage of opj\_int\_ceildiv can cause overflows [\#889](https://github.com/uclouvain/openjpeg/issues/889)
|
||||
- Undefined shift in opj\_get\_all\_encoding\_parameters [\#885](https://github.com/uclouvain/openjpeg/issues/885)
|
||||
- Denial of service \(crash\) due to use-after-free when decoding an illegal JPEG2000 image file v2.1.2 \(2017-04 [\#880](https://github.com/uclouvain/openjpeg/issues/880)
|
||||
- Denial of service \(crash\) when decoding an illegal JPEG2000 image file v2.1.2 \(2017-03\) [\#879](https://github.com/uclouvain/openjpeg/issues/879)
|
||||
- bug png 2 j2k [\#868](https://github.com/uclouvain/openjpeg/issues/868)
|
||||
- Inconsistent compression using cinema settings on folder of non-compliant image [\#864](https://github.com/uclouvain/openjpeg/issues/864)
|
||||
- Openjpeg-2.1.2 Heap Buffer Overflow Vulnerability due to Insufficient check [\#862](https://github.com/uclouvain/openjpeg/issues/862)
|
||||
- Heap Buffer Overflow in function pnmtoimage of convert.c [\#861](https://github.com/uclouvain/openjpeg/issues/861)
|
||||
- CVE-2016-9112 FPE\(Floating Point Exception\) in lib/openjp2/pi.c:523 [\#855](https://github.com/uclouvain/openjpeg/issues/855)
|
||||
- CVE-2016-5139, CVE-2016-5152, CVE-2016-5158, CVE-2016-5159 [\#854](https://github.com/uclouvain/openjpeg/issues/854)
|
||||
- Undefined Reference error [\#853](https://github.com/uclouvain/openjpeg/issues/853)
|
||||
- opj\_compress with lossy compression results in strange pixel values [\#851](https://github.com/uclouvain/openjpeg/issues/851)
|
||||
- CVE-2016-1626 and CVE-2016-1628 [\#850](https://github.com/uclouvain/openjpeg/issues/850)
|
||||
- Out-of-Bounds Write in opj\_mqc\_byteout of mqc.c [\#835](https://github.com/uclouvain/openjpeg/issues/835)
|
||||
- WARNING in tgt\_create tree-\>numnodes == 0, no tree created. [\#794](https://github.com/uclouvain/openjpeg/issues/794)
|
||||
- Potential overflow when precision is larger than 32 [\#781](https://github.com/uclouvain/openjpeg/issues/781)
|
||||
- division-by-zero in function opj\_pi\_next\_rpcl of pi.c \(line 366\) [\#780](https://github.com/uclouvain/openjpeg/issues/780)
|
||||
- division-by-zero in function opj\_pi\_next\_rpcl of pi.c \(line 363\) [\#779](https://github.com/uclouvain/openjpeg/issues/779)
|
||||
- division-by-zero in function opj\_pi\_next\_pcrl of pi.c \(line 447\) [\#778](https://github.com/uclouvain/openjpeg/issues/778)
|
||||
- division-by-zero in function opj\_pi\_next\_pcrl of pi.c \(line 444\) [\#777](https://github.com/uclouvain/openjpeg/issues/777)
|
||||
- Encoding the following file with 32x32 tiling produces jp2 image with artifact [\#737](https://github.com/uclouvain/openjpeg/issues/737)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_pi\_next\_cprl function \(line 526 of pi.c\) [\#732](https://github.com/uclouvain/openjpeg/issues/732)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_pi\_next\_cprl function \(line 523 of pi.c\) [\#731](https://github.com/uclouvain/openjpeg/issues/731)
|
||||
- OpenJpeg 2.1 and 1.4 fails to decompress this file correctly [\#721](https://github.com/uclouvain/openjpeg/issues/721)
|
||||
- MQ Encode :uninitialized memory access when first pass does not output any bytes [\#709](https://github.com/uclouvain/openjpeg/issues/709)
|
||||
- Out-of-bounds read in opj\_j2k\_update\_image\_data and opj\_tgt\_reset function [\#704](https://github.com/uclouvain/openjpeg/issues/704)
|
||||
- Remove opj\_aligned\_malloc / opj\_aligned\_realloc / opj\_aligned\_free? [\#689](https://github.com/uclouvain/openjpeg/issues/689)
|
||||
- There is an issue with rendering some type of jpeg file. Please ref the link. [\#672](https://github.com/uclouvain/openjpeg/issues/672)
|
||||
- Null Dereference in tcd\_malloc\_decode\_tile [\#657](https://github.com/uclouvain/openjpeg/issues/657)
|
||||
- ETS-C1P0-p0\_12.j2k-compare2ref & NR-C1P0-p0\_12.j2k-compare2base failing under windows [\#655](https://github.com/uclouvain/openjpeg/issues/655)
|
||||
- Memory leak [\#631](https://github.com/uclouvain/openjpeg/issues/631)
|
||||
- Test 481 reports error in valgrind memcheck [\#612](https://github.com/uclouvain/openjpeg/issues/612)
|
||||
- reserved identifier violation [\#587](https://github.com/uclouvain/openjpeg/issues/587)
|
||||
- Buffer overflow when compressing some 16 bits images of the test suite [\#539](https://github.com/uclouvain/openjpeg/issues/539)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#480](https://github.com/uclouvain/openjpeg/issues/480)
|
||||
- Automated fuzz testing [\#468](https://github.com/uclouvain/openjpeg/issues/468)
|
||||
- Expected to find EPH marker [\#425](https://github.com/uclouvain/openjpeg/issues/425)
|
||||
- read: segment too long \(6182\) with max \(35872\) for codeblock 0 \(p=19, b=2, r=5, c=1\) [\#284](https://github.com/uclouvain/openjpeg/issues/284)
|
||||
- building 64bit version has lots of warnings [\#244](https://github.com/uclouvain/openjpeg/issues/244)
|
||||
- Wrong encoding of small tiles with high level number [\#239](https://github.com/uclouvain/openjpeg/issues/239)
|
||||
- Errors raised in pi.c by VS11 analyzer [\#190](https://github.com/uclouvain/openjpeg/issues/190)
|
||||
- Undocumented optimization found in v2 branch of openjpeg [\#183](https://github.com/uclouvain/openjpeg/issues/183)
|
||||
- T1 optimisations jpeg2000 [\#172](https://github.com/uclouvain/openjpeg/issues/172)
|
||||
- Remove OPJ\_NOSANITIZE in opj\_bio\_read\(\) and opj\_bio\_write\(\) \(\#761\) [\#955](https://github.com/uclouvain/openjpeg/pull/955) ([rouault](https://github.com/rouault))
|
||||
- Fix bypass pterm termall and lossless decomposition issue \(\#891, \#892\) [\#949](https://github.com/uclouvain/openjpeg/pull/949) ([rouault](https://github.com/rouault))
|
||||
- Escape quotes to ensure README renders on GitHub correctly [\#914](https://github.com/uclouvain/openjpeg/pull/914) ([alexwlchan](https://github.com/alexwlchan))
|
||||
- Remove spurious .R macros from manpages [\#899](https://github.com/uclouvain/openjpeg/pull/899) ([jwilk](https://github.com/jwilk))
|
||||
- Remove warnings related to empty tag-trees. [\#893](https://github.com/uclouvain/openjpeg/pull/893) ([rouault](https://github.com/rouault))
|
||||
|
||||
**Maintenance-related tasks:**
|
||||
|
||||
- Submit OpenJPEG to oss-fuzz [\#965](https://github.com/uclouvain/openjpeg/issues/965)
|
||||
- Updates for Doxygen to suppress warnings [\#849](https://github.com/uclouvain/openjpeg/issues/849)
|
||||
- Remove useless knownfailures \(since LAZY encoding is fixed\) [\#964](https://github.com/uclouvain/openjpeg/pull/964) ([rouault](https://github.com/rouault))
|
||||
- Enable AVX2 at runtime on Travis-CI and AppVeyor [\#963](https://github.com/uclouvain/openjpeg/pull/963) ([rouault](https://github.com/rouault))
|
||||
- Tests: test opj\_compress in VSC mode \(related to \#172\) [\#935](https://github.com/uclouvain/openjpeg/pull/935) ([rouault](https://github.com/rouault))
|
||||
- Reformat: apply reformattin on .h files \(\#128\) [\#926](https://github.com/uclouvain/openjpeg/pull/926) ([rouault](https://github.com/rouault))
|
||||
- Add mechanisms to reformat and check code style, and reformat whole codebase \(\#128\) [\#919](https://github.com/uclouvain/openjpeg/pull/919) ([rouault](https://github.com/rouault))
|
||||
- Add profiling of CPU and memory usage \(\#912\) [\#918](https://github.com/uclouvain/openjpeg/pull/918) ([rouault](https://github.com/rouault))
|
||||
- Add performance benchmarking scripts [\#917](https://github.com/uclouvain/openjpeg/pull/917) ([rouault](https://github.com/rouault))
|
||||
- Fix retrieval of jpylyzer in AppVeyor [\#915](https://github.com/uclouvain/openjpeg/pull/915) ([rouault](https://github.com/rouault))
|
||||
|
||||
## [v2.1.2](https://github.com/uclouvain/openjpeg/releases/v2.1.2) (2016-09-28)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.1...v2.1.2)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- null ptr dereference in convert.c:1331 [\#843](https://github.com/uclouvain/openjpeg/issues/843)
|
||||
- Out-of-Bounds Read in function bmp24toimage of convertbmp.c [\#833](https://github.com/uclouvain/openjpeg/issues/833)
|
||||
- Disable automatic compilation of t1\_generate\_luts in CMakeLists.txt [\#831](https://github.com/uclouvain/openjpeg/issues/831)
|
||||
- CVE-2016-7163 Integer overflow in opj\_pi\_create\_decode [\#826](https://github.com/uclouvain/openjpeg/issues/826)
|
||||
- Security Advisory for OpenJPEG [\#810](https://github.com/uclouvain/openjpeg/issues/810)
|
||||
- Add dashboard with static lib [\#804](https://github.com/uclouvain/openjpeg/issues/804)
|
||||
- hidden visibility for the static library / building with -DOPJ\_STATIC against shared lib [\#802](https://github.com/uclouvain/openjpeg/issues/802)
|
||||
- Optimization when building library from source [\#799](https://github.com/uclouvain/openjpeg/issues/799)
|
||||
- unsigned int16 on Solaris 11.2/sparc [\#796](https://github.com/uclouvain/openjpeg/issues/796)
|
||||
- appveyor [\#793](https://github.com/uclouvain/openjpeg/issues/793)
|
||||
- FFMpeg will not link to 2.1.1 release built as shared library [\#766](https://github.com/uclouvain/openjpeg/issues/766)
|
||||
- API change since v2: opj\_event\_mgr\_t not available [\#754](https://github.com/uclouvain/openjpeg/issues/754)
|
||||
- openjpeg.h needs dependencies [\#673](https://github.com/uclouvain/openjpeg/issues/673)
|
||||
- "master" does not build on ubuntu [\#658](https://github.com/uclouvain/openjpeg/issues/658)
|
||||
- Package 'openjp2', required by 'libopenjpip', not found [\#594](https://github.com/uclouvain/openjpeg/issues/594)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Fix PNM file reading [\#847](https://github.com/uclouvain/openjpeg/pull/847) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some issues reported by Coverity Scan [\#846](https://github.com/uclouvain/openjpeg/pull/846) ([stweil](https://github.com/stweil))
|
||||
- Fix potential out-of-bounds read \(coverity\) [\#844](https://github.com/uclouvain/openjpeg/pull/844) ([stweil](https://github.com/stweil))
|
||||
- Remove TODO for overflow check [\#842](https://github.com/uclouvain/openjpeg/pull/842) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow checks for opj\_aligned\_malloc [\#841](https://github.com/uclouvain/openjpeg/pull/841) ([mayeut](https://github.com/mayeut))
|
||||
- Flags in T1 shall be unsigned [\#840](https://github.com/uclouvain/openjpeg/pull/840) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some warnings [\#838](https://github.com/uclouvain/openjpeg/pull/838) ([mayeut](https://github.com/mayeut))
|
||||
- Fix issue 833. [\#834](https://github.com/uclouvain/openjpeg/pull/834) ([trylab](https://github.com/trylab))
|
||||
- Add overflow checks for opj\_aligned\_malloc [\#832](https://github.com/uclouvain/openjpeg/pull/832) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for issue 820 [\#829](https://github.com/uclouvain/openjpeg/pull/829) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for issue 826 [\#827](https://github.com/uclouvain/openjpeg/pull/827) ([mayeut](https://github.com/mayeut))
|
||||
- Fix coverity 113065 \(CWE-484\) [\#824](https://github.com/uclouvain/openjpeg/pull/824) ([mayeut](https://github.com/mayeut))
|
||||
- Add sanity check for tile coordinates [\#823](https://github.com/uclouvain/openjpeg/pull/823) ([mayeut](https://github.com/mayeut))
|
||||
- Add test for PR 818 [\#822](https://github.com/uclouvain/openjpeg/pull/822) ([mayeut](https://github.com/mayeut))
|
||||
- Update to libpng 1.6.25 [\#821](https://github.com/uclouvain/openjpeg/pull/821) ([mayeut](https://github.com/mayeut))
|
||||
- CVE-2016-8332: fix incrementing of "l\_tcp-\>m\_nb\_mcc\_records" in opj\_j2k\_read\_mcc [\#820](https://github.com/uclouvain/openjpeg/pull/820) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow check in opj\_tcd\_init\_tile [\#819](https://github.com/uclouvain/openjpeg/pull/819) ([mayeut](https://github.com/mayeut))
|
||||
- Fix leak & invalid behavior of opj\_jp2\_read\_ihdr [\#818](https://github.com/uclouvain/openjpeg/pull/818) ([mayeut](https://github.com/mayeut))
|
||||
- Add overflow check in opj\_j2k\_update\_image\_data [\#817](https://github.com/uclouvain/openjpeg/pull/817) ([mayeut](https://github.com/mayeut))
|
||||
- Change 'restrict' define to 'OPJ\_RESTRICT' [\#816](https://github.com/uclouvain/openjpeg/pull/816) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to clang 3.8 [\#814](https://github.com/uclouvain/openjpeg/pull/814) ([mayeut](https://github.com/mayeut))
|
||||
- Fix an integer overflow issue [\#809](https://github.com/uclouvain/openjpeg/pull/809) ([trylab](https://github.com/trylab))
|
||||
- Update to lcms 2.8 [\#808](https://github.com/uclouvain/openjpeg/pull/808) ([mayeut](https://github.com/mayeut))
|
||||
- Update to libpng 1.6.24 [\#807](https://github.com/uclouvain/openjpeg/pull/807) ([mayeut](https://github.com/mayeut))
|
||||
- Reenable clang-3.9 build on travis [\#806](https://github.com/uclouvain/openjpeg/pull/806) ([mayeut](https://github.com/mayeut))
|
||||
- Bit fields type [\#805](https://github.com/uclouvain/openjpeg/pull/805) ([smuehlst](https://github.com/smuehlst))
|
||||
- Add compilation test for standalone inclusion of openjpeg.h [\#798](https://github.com/uclouvain/openjpeg/pull/798) ([mayeut](https://github.com/mayeut))
|
||||
- jpwl: Remove non-portable data type u\_int16\_t \(fix issue \#796\) [\#797](https://github.com/uclouvain/openjpeg/pull/797) ([stweil](https://github.com/stweil))
|
||||
- Fix dependency for pkg-config \(issue \#594\) [\#795](https://github.com/uclouvain/openjpeg/pull/795) ([stweil](https://github.com/stweil))
|
||||
- Add .gitignore [\#787](https://github.com/uclouvain/openjpeg/pull/787) ([stweil](https://github.com/stweil))
|
||||
|
||||
## [v2.1.1](https://github.com/uclouvain/openjpeg/releases/tag/v2.1.1) (2016-07-05)
|
||||
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.1...v2.1.1)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
- opj\_malloc replacement [\#625](https://github.com/uclouvain/openjpeg/issues/625)
|
||||
- backport "-p" and "-force-rgb" options in 1.5 [\#606](https://github.com/uclouvain/openjpeg/issues/606)
|
||||
- Use travis-ci matrix build [\#581](https://github.com/uclouvain/openjpeg/issues/581)
|
||||
- Add Coverity Scan analysis [\#580](https://github.com/uclouvain/openjpeg/issues/580)
|
||||
- Unnecessary rate distortion calculations [\#479](https://github.com/uclouvain/openjpeg/issues/479)
|
||||
- Add images from various security issues to test suite [\#415](https://github.com/uclouvain/openjpeg/issues/415)
|
||||
- Coding speed for 9/7 on 32bits platforms \(x86/ARM\) can be improved with a quick fix [\#220](https://github.com/uclouvain/openjpeg/issues/220)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Out-of-Bounds Access in function opj\_tgt\_reset of tgt.c [\#775](https://github.com/uclouvain/openjpeg/issues/775)
|
||||
- Heap Buffer Overflow in function color\_cmyk\_to\_rgb of color.c [\#774](https://github.com/uclouvain/openjpeg/issues/774)
|
||||
- division-by-zero \(SIGFPE\) error in opj\_tcd\_init\_tile function \(line 730 of tcd.c\) [\#733](https://github.com/uclouvain/openjpeg/issues/733)
|
||||
- Out-Of-Bounds Read in sycc422\_to\_rgb function [\#726](https://github.com/uclouvain/openjpeg/issues/726)
|
||||
- Heap Corruption in opj\_free function [\#725](https://github.com/uclouvain/openjpeg/issues/725)
|
||||
- Out-Of-Bounds Read in opj\_tcd\_free\_tile function [\#724](https://github.com/uclouvain/openjpeg/issues/724)
|
||||
- Cannot handle box of undefined size [\#653](https://github.com/uclouvain/openjpeg/issues/653)
|
||||
- Compilation fails without platform-supplied aligned malloc [\#642](https://github.com/uclouvain/openjpeg/issues/642)
|
||||
- HP compiler warns about redeclaration of static function [\#640](https://github.com/uclouvain/openjpeg/issues/640)
|
||||
- Implementation-defined behavior of malloc causes different behavior on Linux and AIX [\#635](https://github.com/uclouvain/openjpeg/issues/635)
|
||||
- Build on AIX fails because "opj\_includes.h" is included after system headers [\#633](https://github.com/uclouvain/openjpeg/issues/633)
|
||||
- Compiling with SSE2 on Linux 32-bit causes crashes in OpenJPEG [\#624](https://github.com/uclouvain/openjpeg/issues/624)
|
||||
- Build on AIX fails because of "restrict" pointers [\#620](https://github.com/uclouvain/openjpeg/issues/620)
|
||||
- bug in new tif conversion code [\#609](https://github.com/uclouvain/openjpeg/issues/609)
|
||||
- bin/jp2/convert.c line 1085 Resource leak [\#607](https://github.com/uclouvain/openjpeg/issues/607)
|
||||
- bin/jp2/convert.c memory leak [\#601](https://github.com/uclouvain/openjpeg/issues/601)
|
||||
- Resource leak in opj\_j2k\_create\_cstr\_index in case of failure [\#599](https://github.com/uclouvain/openjpeg/issues/599)
|
||||
- Resource leak in opj\_j2k\_encode in case of failure [\#598](https://github.com/uclouvain/openjpeg/issues/598)
|
||||
- Resource leak in opj\_j2k\_decode\_one\_tile in case of failure [\#597](https://github.com/uclouvain/openjpeg/issues/597)
|
||||
- Resource Leak [\#573](https://github.com/uclouvain/openjpeg/issues/573)
|
||||
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) [\#571](https://github.com/uclouvain/openjpeg/issues/571)
|
||||
- Use-after-free in opj\_j2k\_write\_mco [\#563](https://github.com/uclouvain/openjpeg/issues/563)
|
||||
- openjpeg-master-2015-07-30 failed to compile on LINUX [\#556](https://github.com/uclouvain/openjpeg/issues/556)
|
||||
- PNG images are always read as RGB\(A\) images [\#536](https://github.com/uclouvain/openjpeg/issues/536)
|
||||
- g4\_colr.j2c not handled properly [\#532](https://github.com/uclouvain/openjpeg/issues/532)
|
||||
- Bigendian: opj\_compress + opj\_decompress fails [\#518](https://github.com/uclouvain/openjpeg/issues/518)
|
||||
- Suspicious code in j2k.c [\#517](https://github.com/uclouvain/openjpeg/issues/517)
|
||||
- Decode times almost double\(!!\) on Visual Studio 2013, 2015 [\#505](https://github.com/uclouvain/openjpeg/issues/505)
|
||||
- opj\_data/input/nonregression/issue226.j2k [\#500](https://github.com/uclouvain/openjpeg/issues/500)
|
||||
- opj\_setup\_encoder always returns true [\#497](https://github.com/uclouvain/openjpeg/issues/497)
|
||||
- Double free in j2k\_read\_ppm\_v3 parsing \(\(presumably invalid\) image. [\#496](https://github.com/uclouvain/openjpeg/issues/496)
|
||||
- Invalid write in opj\_j2k\_update\_image\_data [\#495](https://github.com/uclouvain/openjpeg/issues/495)
|
||||
- Undefined printf format specifier %ud used in code [\#494](https://github.com/uclouvain/openjpeg/issues/494)
|
||||
- Potential double free on malloc failure in opj\_j2k\_copy\_default\_tcp\_and\_create\_tcp\(\) [\#492](https://github.com/uclouvain/openjpeg/issues/492)
|
||||
- Do not link with -ffast-math [\#488](https://github.com/uclouvain/openjpeg/issues/488)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode [\#486](https://github.com/uclouvain/openjpeg/issues/486)
|
||||
- opj\_dump fails on Windows 7, 64 bits [\#482](https://github.com/uclouvain/openjpeg/issues/482)
|
||||
- SIGSEGV in opj\_j2k\_update\_image\_data via pdfium\_test [\#481](https://github.com/uclouvain/openjpeg/issues/481)
|
||||
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#477](https://github.com/uclouvain/openjpeg/issues/477)
|
||||
- Invalid image causes write past end of heap buffer [\#476](https://github.com/uclouvain/openjpeg/issues/476)
|
||||
- Assertion `l\_res-\>x0 \>= 0' fails when parsing invalid images [\#475](https://github.com/uclouvain/openjpeg/issues/475)
|
||||
- Bug on opj\_write\_bytes\_BE function [\#472](https://github.com/uclouvain/openjpeg/issues/472)
|
||||
- Refactor j2k\_read\_ppm\_v3 function [\#470](https://github.com/uclouvain/openjpeg/issues/470)
|
||||
- compression: strange precinct dimensions [\#466](https://github.com/uclouvain/openjpeg/issues/466)
|
||||
- \(:- Console message in opj\_decompress -:\) [\#465](https://github.com/uclouvain/openjpeg/issues/465)
|
||||
- opj\_decompress fails to decompress any files [\#463](https://github.com/uclouvain/openjpeg/issues/463)
|
||||
- bio-\>ct is unnecessarily set to zero in opj\_bio\_flush method [\#461](https://github.com/uclouvain/openjpeg/issues/461)
|
||||
- Maximal unsigned short is 65535, not 65536 [\#460](https://github.com/uclouvain/openjpeg/issues/460)
|
||||
- OpenJpeg fails to encode components with different precision properly [\#459](https://github.com/uclouvain/openjpeg/issues/459)
|
||||
- component precision upscaling isn't correct in opj\_decompress [\#458](https://github.com/uclouvain/openjpeg/issues/458)
|
||||
- Multiple precision components won't get encoded to jp2 if 1 component is unsigned 1 bit [\#457](https://github.com/uclouvain/openjpeg/issues/457)
|
||||
- Incorrect code in ../bin/jp2/convert.c, function rawtoimage\_common\(...\) [\#456](https://github.com/uclouvain/openjpeg/issues/456)
|
||||
- \[OpenJPEG-trunk\] opj\_stream\_get\_number\_byte\_left throws assert [\#455](https://github.com/uclouvain/openjpeg/issues/455)
|
||||
- NR-DEC-kodak\_2layers\_lrcp.j2c-31-decode-md5 fails randomly when running tests in parallel [\#454](https://github.com/uclouvain/openjpeg/issues/454)
|
||||
- compare\_raw\_files doesn't report an error on invalid arguments / missing input files [\#453](https://github.com/uclouvain/openjpeg/issues/453)
|
||||
- Forward discrete wavelet transform: implement periodic symmetric extension at boundaries [\#452](https://github.com/uclouvain/openjpeg/issues/452)
|
||||
- Bug in tiff reading method in convert.c [\#449](https://github.com/uclouvain/openjpeg/issues/449)
|
||||
- Image in pdf don't display [\#447](https://github.com/uclouvain/openjpeg/issues/447)
|
||||
- Multiple issues causing opj\_decompress to segfault [\#446](https://github.com/uclouvain/openjpeg/issues/446)
|
||||
- opj\_compress: 40% of encode time is spent freeing data [\#445](https://github.com/uclouvain/openjpeg/issues/445)
|
||||
- Multiple warnings when configuring OpenJPEG on MacOS with CMake 3.x \(trunk\) [\#443](https://github.com/uclouvain/openjpeg/issues/443)
|
||||
- valgrind memleak found [\#437](https://github.com/uclouvain/openjpeg/issues/437)
|
||||
- global-buffer-overflow src/lib/openjp2/t1.c:1146 opj\_t1\_getwmsedec [\#436](https://github.com/uclouvain/openjpeg/issues/436)
|
||||
- Warning introduced on trunk r2923 & r2924 [\#435](https://github.com/uclouvain/openjpeg/issues/435)
|
||||
- heap-buffer-overflow in opj\_t1\_decode\_cblks [\#432](https://github.com/uclouvain/openjpeg/issues/432)
|
||||
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#431](https://github.com/uclouvain/openjpeg/issues/431)
|
||||
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#430](https://github.com/uclouvain/openjpeg/issues/430)
|
||||
- Heap-buffer-overflow in opj\_jp2\_apply\_pclr [\#429](https://github.com/uclouvain/openjpeg/issues/429)
|
||||
- issue412 revisited [\#428](https://github.com/uclouvain/openjpeg/issues/428)
|
||||
- Image distorted \(sides look cankered\) [\#423](https://github.com/uclouvain/openjpeg/issues/423)
|
||||
- openjpeg-2.x-trunk-r2918 is broken in color.c [\#422](https://github.com/uclouvain/openjpeg/issues/422)
|
||||
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#420](https://github.com/uclouvain/openjpeg/issues/420)
|
||||
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#418](https://github.com/uclouvain/openjpeg/issues/418)
|
||||
- UNKNOWN in opj\_read\_bytes\_LE [\#417](https://github.com/uclouvain/openjpeg/issues/417)
|
||||
- Transparency problem [\#416](https://github.com/uclouvain/openjpeg/issues/416)
|
||||
- Image with per channel alpha \(cdef\) does not decode properly [\#414](https://github.com/uclouvain/openjpeg/issues/414)
|
||||
- OpenJPEG crashes with attached image [\#413](https://github.com/uclouvain/openjpeg/issues/413)
|
||||
- Palette image with cdef fails to decompress [\#412](https://github.com/uclouvain/openjpeg/issues/412)
|
||||
- Invalid member values from opj\_read\_header or opj\_decode ? [\#411](https://github.com/uclouvain/openjpeg/issues/411)
|
||||
- MD5 Checksum hangs under valgrind on MacOS X [\#410](https://github.com/uclouvain/openjpeg/issues/410)
|
||||
- Heap-buffer-overflow in opj\_tcd\_get\_decoded\_tile\_size [\#408](https://github.com/uclouvain/openjpeg/issues/408)
|
||||
- C++ style comments in trunk/src/lib/openjp2/j2k.c [\#407](https://github.com/uclouvain/openjpeg/issues/407)
|
||||
- Backport bugfixes from trunk to 2.1 branch [\#405](https://github.com/uclouvain/openjpeg/issues/405)
|
||||
- Heap-buffer-overflow in parse\_cmdline\_encoder [\#403](https://github.com/uclouvain/openjpeg/issues/403)
|
||||
- Heap-buffer-overflow in opj\_v4dwt\_interleave\_h [\#400](https://github.com/uclouvain/openjpeg/issues/400)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode [\#399](https://github.com/uclouvain/openjpeg/issues/399)
|
||||
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#398](https://github.com/uclouvain/openjpeg/issues/398)
|
||||
- Heap-buffer-overflow in opj\_jp2\_apply\_cdef [\#397](https://github.com/uclouvain/openjpeg/issues/397)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#396](https://github.com/uclouvain/openjpeg/issues/396)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#395](https://github.com/uclouvain/openjpeg/issues/395)
|
||||
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#394](https://github.com/uclouvain/openjpeg/issues/394)
|
||||
- Heap-double-free in j2k\_read\_ppm\_v3 [\#393](https://github.com/uclouvain/openjpeg/issues/393)
|
||||
- Security hole in j2k.c [\#392](https://github.com/uclouvain/openjpeg/issues/392)
|
||||
- Security: double-free in opj\_tcd\_code\_block\_dec\_deallocate [\#391](https://github.com/uclouvain/openjpeg/issues/391)
|
||||
- check for negative-size params in code [\#390](https://github.com/uclouvain/openjpeg/issues/390)
|
||||
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#389](https://github.com/uclouvain/openjpeg/issues/389)
|
||||
- Heap overflow in OpenJpeg 1.5.2 [\#388](https://github.com/uclouvain/openjpeg/issues/388)
|
||||
- openjpip.so.6 file too short [\#387](https://github.com/uclouvain/openjpeg/issues/387)
|
||||
- Corrupted JP3D file [\#386](https://github.com/uclouvain/openjpeg/issues/386)
|
||||
- variable assigned to itself [\#383](https://github.com/uclouvain/openjpeg/issues/383)
|
||||
- Null pointer dereferencing [\#382](https://github.com/uclouvain/openjpeg/issues/382)
|
||||
- bad use of case statement [\#381](https://github.com/uclouvain/openjpeg/issues/381)
|
||||
- Release 2.1 as a Ubuntu package [\#380](https://github.com/uclouvain/openjpeg/issues/380)
|
||||
- Bug in libopenjpwl.pc [\#374](https://github.com/uclouvain/openjpeg/issues/374)
|
||||
- inconsistent tile numbering in decode output message [\#370](https://github.com/uclouvain/openjpeg/issues/370)
|
||||
- error in code block calculations [\#369](https://github.com/uclouvain/openjpeg/issues/369)
|
||||
- r2872 fails to compile due to "attempt to use poisoned malloc" error in j2k.c [\#368](https://github.com/uclouvain/openjpeg/issues/368)
|
||||
- OSX build gives libopenjp2.6.dylib with not-absolute install name id [\#367](https://github.com/uclouvain/openjpeg/issues/367)
|
||||
- opj\_decompress gives error but successfully decompress in OPJ 2.1 [\#366](https://github.com/uclouvain/openjpeg/issues/366)
|
||||
- pngtoimage\(\) and imagetopng\(\) have wrong byte order for 16-Bit image [\#365](https://github.com/uclouvain/openjpeg/issues/365)
|
||||
- PDF crash in chrome - part2 \(due to attachment limit\) [\#364](https://github.com/uclouvain/openjpeg/issues/364)
|
||||
- PDF crash in chrome - part1 [\#363](https://github.com/uclouvain/openjpeg/issues/363)
|
||||
- PDF crash in chrome - part0 [\#362](https://github.com/uclouvain/openjpeg/issues/362)
|
||||
- Compilation fails on Windows with mingw32 gcc4.8 [\#361](https://github.com/uclouvain/openjpeg/issues/361)
|
||||
- security issue [\#360](https://github.com/uclouvain/openjpeg/issues/360)
|
||||
- improve memory management [\#359](https://github.com/uclouvain/openjpeg/issues/359)
|
||||
- how to compress a yuv420 raw data using opj\_compress [\#357](https://github.com/uclouvain/openjpeg/issues/357)
|
||||
- Some memory allocation are not checked [\#355](https://github.com/uclouvain/openjpeg/issues/355)
|
||||
- Static library symbols shall be marked as hidden [\#354](https://github.com/uclouvain/openjpeg/issues/354)
|
||||
- opj\_compress rejects valid bmp files [\#353](https://github.com/uclouvain/openjpeg/issues/353)
|
||||
- opj\_compress crashes when number of resolutions is set to zero [\#352](https://github.com/uclouvain/openjpeg/issues/352)
|
||||
- Compilation error under Visual Studio 2003 [\#351](https://github.com/uclouvain/openjpeg/issues/351)
|
||||
- opj\_compress description example error \[Low priority\] [\#350](https://github.com/uclouvain/openjpeg/issues/350)
|
||||
- opj\_write\_bytes\_BE is wrong in trunk [\#345](https://github.com/uclouvain/openjpeg/issues/345)
|
||||
- PART1ONLY option in release.sh doesn't work properly [\#332](https://github.com/uclouvain/openjpeg/issues/332)
|
||||
- openjpeg crash error [\#330](https://github.com/uclouvain/openjpeg/issues/330)
|
||||
- openjpeg decompress error [\#329](https://github.com/uclouvain/openjpeg/issues/329)
|
||||
- openjpeg decompress issue [\#326](https://github.com/uclouvain/openjpeg/issues/326)
|
||||
- limited tif support [\#322](https://github.com/uclouvain/openjpeg/issues/322)
|
||||
- asoc value of 65536 is allowed [\#321](https://github.com/uclouvain/openjpeg/issues/321)
|
||||
- opj\_skip\_from\_file error [\#314](https://github.com/uclouvain/openjpeg/issues/314)
|
||||
- Heavy quota usage in openjpeg [\#309](https://github.com/uclouvain/openjpeg/issues/309)
|
||||
- Verify -help actually match letter [\#307](https://github.com/uclouvain/openjpeg/issues/307)
|
||||
- g3\_colr.j2c not handled [\#288](https://github.com/uclouvain/openjpeg/issues/288)
|
||||
- reopen/fix issue 165 [\#280](https://github.com/uclouvain/openjpeg/issues/280)
|
||||
- kakadu conformance tests [\#279](https://github.com/uclouvain/openjpeg/issues/279)
|
||||
- missing break after case statement in opj\_dwt\_decode\_real [\#274](https://github.com/uclouvain/openjpeg/issues/274)
|
||||
- Run Coverity on trunk [\#270](https://github.com/uclouvain/openjpeg/issues/270)
|
||||
- NR-ENC-random-issue-0005.tif-12-encode [\#259](https://github.com/uclouvain/openjpeg/issues/259)
|
||||
- Use new add\_test signature to handle cross compilation [\#258](https://github.com/uclouvain/openjpeg/issues/258)
|
||||
- Loss decoding quality in 2.0.0 [\#254](https://github.com/uclouvain/openjpeg/issues/254)
|
||||
- Decompress that worked in 1.5.1 fails in 2.0 [\#252](https://github.com/uclouvain/openjpeg/issues/252)
|
||||
- Expected endianness with raw input is not documented leading to SEGFAULT [\#251](https://github.com/uclouvain/openjpeg/issues/251)
|
||||
- OpenJPEG writes to stderr [\#246](https://github.com/uclouvain/openjpeg/issues/246)
|
||||
- Inconsistent logging of tile index [\#245](https://github.com/uclouvain/openjpeg/issues/245)
|
||||
- patch for openjpeg-trunk-r2347 and BIG\_ENDIAN [\#242](https://github.com/uclouvain/openjpeg/issues/242)
|
||||
- CMAP: MTYP == 0 \(direct use\) not handled properly [\#235](https://github.com/uclouvain/openjpeg/issues/235)
|
||||
- Black Pixel [\#233](https://github.com/uclouvain/openjpeg/issues/233)
|
||||
- opj\_compress runtime error after fresh Linux install due to apparent failure to execute ldconfig [\#219](https://github.com/uclouvain/openjpeg/issues/219)
|
||||
- openjp2 debug works, release build does not [\#217](https://github.com/uclouvain/openjpeg/issues/217)
|
||||
- openjpeg-branch15-r2299 and openjpeg-trunk-r2299 fail to decode a JP2 file [\#212](https://github.com/uclouvain/openjpeg/issues/212)
|
||||
- openjpeg-trunk issue with Win7 [\#201](https://github.com/uclouvain/openjpeg/issues/201)
|
||||
- undefined reference to `opj\_version' [\#200](https://github.com/uclouvain/openjpeg/issues/200)
|
||||
- In tgt.c we used fprintf not the openjpeg message reporter [\#184](https://github.com/uclouvain/openjpeg/issues/184)
|
||||
- Windows binaries not working under WinXP [\#176](https://github.com/uclouvain/openjpeg/issues/176)
|
||||
- add ability to use intel ipp \(performance primitive\) within OpenJPEG [\#164](https://github.com/uclouvain/openjpeg/issues/164)
|
||||
- Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
|
||||
- Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
|
||||
- Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
|
||||
- openjpeg@googlegroups.com has disappeared [\#153](https://github.com/uclouvain/openjpeg/issues/153)
|
||||
- OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
|
||||
- opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
|
||||
- Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
|
||||
- Problem with second layer of a 2 layer coded LRCP \(with precincts\) [\#135](https://github.com/uclouvain/openjpeg/issues/135)
|
||||
- version 1.4 crashes when opening PDF file with JPEG2000 images [\#133](https://github.com/uclouvain/openjpeg/issues/133)
|
||||
- Setup a win64 dashboard [\#132](https://github.com/uclouvain/openjpeg/issues/132)
|
||||
- J2KP4files/codestreams\_profile0/p0\_13.j2k question jpeg2000 [\#131](https://github.com/uclouvain/openjpeg/issues/131)
|
||||
- Out of memory: Kill process 11204 \(opj\_server\) score 917 or sacrifice child [\#123](https://github.com/uclouvain/openjpeg/issues/123)
|
||||
- FILE\* in opj API is unsafe [\#120](https://github.com/uclouvain/openjpeg/issues/120)
|
||||
- third-party lib order [\#119](https://github.com/uclouvain/openjpeg/issues/119)
|
||||
- openjpeg-1.5.0-Darwin-powerpc.dmg is huge ! [\#113](https://github.com/uclouvain/openjpeg/issues/113)
|
||||
- misleading info in JP2 box lead to wrong number of components [\#110](https://github.com/uclouvain/openjpeg/issues/110)
|
||||
- Image\_to\_j2k says that j2k files is generated but no file is on the HDD [\#109](https://github.com/uclouvain/openjpeg/issues/109)
|
||||
- Error in openjpegV1.4 on compiling image\_to\_j2k: crash on reading bmp file [\#108](https://github.com/uclouvain/openjpeg/issues/108)
|
||||
- Update to abi-compliance-checker 1.96 [\#106](https://github.com/uclouvain/openjpeg/issues/106)
|
||||
- Decode error on the attached JPEG...works in KDU and with JASPER...please help! [\#101](https://github.com/uclouvain/openjpeg/issues/101)
|
||||
- Mac binaries v1.4 is broken [\#95](https://github.com/uclouvain/openjpeg/issues/95)
|
||||
- jp2\_read\_boxhdr\(\) has size bug in version 1 [\#92](https://github.com/uclouvain/openjpeg/issues/92)
|
||||
- Support for Java JAI Imageio [\#90](https://github.com/uclouvain/openjpeg/issues/90)
|
||||
- encoding test failing [\#86](https://github.com/uclouvain/openjpeg/issues/86)
|
||||
- source archive on demand [\#85](https://github.com/uclouvain/openjpeg/issues/85)
|
||||
- CMakeLists.txt and Makefile.am for JPIP are buggy [\#84](https://github.com/uclouvain/openjpeg/issues/84)
|
||||
- pclr-cmap-cdef [\#82](https://github.com/uclouvain/openjpeg/issues/82)
|
||||
- Error when compiling openjpeg\_v1\_4\_sources\_r697 [\#79](https://github.com/uclouvain/openjpeg/issues/79)
|
||||
- J2K codec issue on Windows Mobile [\#77](https://github.com/uclouvain/openjpeg/issues/77)
|
||||
- image\_to\_j2k.exe crashes on large .bmp file [\#75](https://github.com/uclouvain/openjpeg/issues/75)
|
||||
- fatal error C1900 building the project on windows [\#65](https://github.com/uclouvain/openjpeg/issues/65)
|
||||
- same option but different size [\#54](https://github.com/uclouvain/openjpeg/issues/54)
|
||||
- Missing openjpegConfigure.h [\#38](https://github.com/uclouvain/openjpeg/issues/38)
|
||||
- Not an issue in openjpeg, but ... [\#37](https://github.com/uclouvain/openjpeg/issues/37)
|
||||
- OpenJPEG-1.3.0 pclr, cmap and cdef [\#27](https://github.com/uclouvain/openjpeg/issues/27)
|
||||
- realloc maybe too big \(t2.c\) [\#26](https://github.com/uclouvain/openjpeg/issues/26)
|
||||
- libopenjpeg/opj\_malloc.h breaks on FreeBSD/Darwin systems [\#20](https://github.com/uclouvain/openjpeg/issues/20)
|
||||
- image\_to\_j2k not outputting to win32 console properly [\#18](https://github.com/uclouvain/openjpeg/issues/18)
|
||||
- \[OpenJPEG\] OpenJPEG\_v13: tiled image part 2 [\#17](https://github.com/uclouvain/openjpeg/issues/17)
|
||||
- JP2 Color Space modification by Matteo Italia [\#13](https://github.com/uclouvain/openjpeg/issues/13)
|
||||
- Patch submission \( exotic video formats, and a few things \) [\#12](https://github.com/uclouvain/openjpeg/issues/12)
|
||||
- 16 bits lossy compression [\#10](https://github.com/uclouvain/openjpeg/issues/10)
|
||||
- pnm file formats not accepting bitdepth greater than 8 bpp [\#8](https://github.com/uclouvain/openjpeg/issues/8)
|
||||
- Heap corruption in j2k encoder [\#5](https://github.com/uclouvain/openjpeg/issues/5)
|
||||
- JPWL crash in marker reallocation\(+patch\), segfault while decoding image with main header protection [\#4](https://github.com/uclouvain/openjpeg/issues/4)
|
||||
- a couple of small errors in libopenjpeg detected by coverity [\#1](https://github.com/uclouvain/openjpeg/issues/1)
|
||||
|
||||
**Closed issues:**
|
||||
|
||||
- Shared library build broken on ubuntu [\#728](https://github.com/uclouvain/openjpeg/issues/728)
|
||||
- opj\_includes.h shouldn't define `\_\_attribute\_\_` [\#727](https://github.com/uclouvain/openjpeg/issues/727)
|
||||
- Possible website problems due to Jekyll upgrade [\#713](https://github.com/uclouvain/openjpeg/issues/713)
|
||||
- Stable Release? [\#712](https://github.com/uclouvain/openjpeg/issues/712)
|
||||
- Meta Issue : try to fix some of these critical bugs before thinking about optimizing the library [\#710](https://github.com/uclouvain/openjpeg/issues/710)
|
||||
- Tiled encoding broken for images with non power of 2 dimensions [\#702](https://github.com/uclouvain/openjpeg/issues/702)
|
||||
- install\_name \(still\) not set on OS X [\#700](https://github.com/uclouvain/openjpeg/issues/700)
|
||||
- Add section in wiki describing where one can get test images [\#699](https://github.com/uclouvain/openjpeg/issues/699)
|
||||
- Make EvenManager into singleton [\#698](https://github.com/uclouvain/openjpeg/issues/698)
|
||||
- Remove old branches from repo [\#696](https://github.com/uclouvain/openjpeg/issues/696)
|
||||
- MQ Coder encode: Conditional jump or move depends on uninitialised value\(s\) [\#695](https://github.com/uclouvain/openjpeg/issues/695)
|
||||
- Can we add these files to our test suite ? [\#688](https://github.com/uclouvain/openjpeg/issues/688)
|
||||
- -t and -d command line flags for decode are not documented on OpenJPEG website [\#685](https://github.com/uclouvain/openjpeg/issues/685)
|
||||
- Decoding at the precinct level [\#676](https://github.com/uclouvain/openjpeg/issues/676)
|
||||
- Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
|
||||
- Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
|
||||
- \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
|
||||
- lossy encoding a 16 bit TIF file : severe artifacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
|
||||
- opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
|
||||
- Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
|
||||
- Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
|
||||
- Serious problem with quantization during lossy encoding [\#615](https://github.com/uclouvain/openjpeg/issues/615)
|
||||
- Decompression does not work with sequential data source [\#613](https://github.com/uclouvain/openjpeg/issues/613)
|
||||
- potential overflow in opj\_tcd\_tile\_t [\#605](https://github.com/uclouvain/openjpeg/issues/605)
|
||||
- Logical condition [\#596](https://github.com/uclouvain/openjpeg/issues/596)
|
||||
- file9.jp2 does not dump correctly on 1.5 [\#595](https://github.com/uclouvain/openjpeg/issues/595)
|
||||
- opj\_compress man page is missing documentation of -jpip option [\#593](https://github.com/uclouvain/openjpeg/issues/593)
|
||||
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) in 1.5 branch [\#591](https://github.com/uclouvain/openjpeg/issues/591)
|
||||
- Example: opj\_compress -i image.j2k -o image.pgm [\#577](https://github.com/uclouvain/openjpeg/issues/577)
|
||||
- Mismatching delete [\#575](https://github.com/uclouvain/openjpeg/issues/575)
|
||||
- Compilation fails on Win7 [\#546](https://github.com/uclouvain/openjpeg/issues/546)
|
||||
- NR-JP2-file5.jp2-compare2base fails with third party libcms [\#540](https://github.com/uclouvain/openjpeg/issues/540)
|
||||
- CTest spits out an error at the end of the test run [\#516](https://github.com/uclouvain/openjpeg/issues/516)
|
||||
- opj\_uint\_adds\(\) is questionable [\#515](https://github.com/uclouvain/openjpeg/issues/515)
|
||||
- Might consider renaming this method: [\#491](https://github.com/uclouvain/openjpeg/issues/491)
|
||||
- opj\_compress run twice gives different fiile sizes for same file [\#490](https://github.com/uclouvain/openjpeg/issues/490)
|
||||
- Android Support [\#483](https://github.com/uclouvain/openjpeg/issues/483)
|
||||
- Add SSE2/SSE41 implementations for mct.c [\#451](https://github.com/uclouvain/openjpeg/issues/451)
|
||||
- Reduce encoder code block memory usage for non 64x64 code block sizes [\#444](https://github.com/uclouvain/openjpeg/issues/444)
|
||||
- valgrind "Uninitialized Memory Read" & "Uninitialized Memory Conditional" found [\#438](https://github.com/uclouvain/openjpeg/issues/438)
|
||||
- No way to debug opj\_tcd\_init\_encode\_tile or opj\_tcd\_init\_decode\_tile [\#433](https://github.com/uclouvain/openjpeg/issues/433)
|
||||
- Add option to call dsymutil on built binaries [\#409](https://github.com/uclouvain/openjpeg/issues/409)
|
||||
- Allow opj\_compress and opj\_decompress to read/write images over stdin/stdout [\#379](https://github.com/uclouvain/openjpeg/issues/379)
|
||||
- reduce memory significantly for single tile RGB encoding [\#375](https://github.com/uclouvain/openjpeg/issues/375)
|
||||
- Switch code repo to github and start using pull request workflow [\#373](https://github.com/uclouvain/openjpeg/issues/373)
|
||||
- This is a BigTIFF file. This format not supported [\#125](https://github.com/uclouvain/openjpeg/issues/125)
|
||||
- Add a test suite to check the convert functions [\#99](https://github.com/uclouvain/openjpeg/issues/99)
|
||||
- Add build config to the dashboard to verify the autotools build [\#88](https://github.com/uclouvain/openjpeg/issues/88)
|
||||
|
||||
**Merged pull requests:**
|
||||
|
||||
- Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
|
||||
- Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
|
||||
- Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
|
||||
- Use lowercase for cmake commands consistently [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
|
||||
- Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
|
||||
- Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
|
||||
- Fix warnings [\#763](https://github.com/uclouvain/openjpeg/pull/763) ([mayeut](https://github.com/mayeut))
|
||||
- Check SSIZ is valid in opj\_j2k\_read\_siz [\#762](https://github.com/uclouvain/openjpeg/pull/762) ([mayeut](https://github.com/mayeut))
|
||||
- Fix unsigned int overflow reported by UBSan [\#761](https://github.com/uclouvain/openjpeg/pull/761) ([mayeut](https://github.com/mayeut))
|
||||
- Fix unsigned int overflow reported by UBSan [\#759](https://github.com/uclouvain/openjpeg/pull/759) ([mayeut](https://github.com/mayeut))
|
||||
- Fix negative shift left reported by UBSan [\#758](https://github.com/uclouvain/openjpeg/pull/758) ([mayeut](https://github.com/mayeut))
|
||||
- Fix negative shift left reported by UBSan [\#757](https://github.com/uclouvain/openjpeg/pull/757) ([mayeut](https://github.com/mayeut))
|
||||
- Add clang 3.9 build to Travis matrix [\#753](https://github.com/uclouvain/openjpeg/pull/753) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix implicit floating bool conversion [\#752](https://github.com/uclouvain/openjpeg/pull/752) ([julienmalik](https://github.com/julienmalik))
|
||||
- Do not define \_\_attribute\_\_ in opj\_includes.h [\#751](https://github.com/uclouvain/openjpeg/pull/751) ([mayeut](https://github.com/mayeut))
|
||||
- Allow to read/write 3/5/7/9/11/13/15 bpp TIF files [\#750](https://github.com/uclouvain/openjpeg/pull/750) ([mayeut](https://github.com/mayeut))
|
||||
- Fix heap-buffer-overflow in color\_esycc\_to\_rgb [\#748](https://github.com/uclouvain/openjpeg/pull/748) ([mayeut](https://github.com/mayeut))
|
||||
- update libpng to from 1.6.17 to 1.6.21 [\#747](https://github.com/uclouvain/openjpeg/pull/747) ([julienmalik](https://github.com/julienmalik))
|
||||
- Update cmake & jpylyzer for travis builds [\#746](https://github.com/uclouvain/openjpeg/pull/746) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix Out-Of-Bounds Read in sycc42x\_to\_rgb function [\#745](https://github.com/uclouvain/openjpeg/pull/745) ([mayeut](https://github.com/mayeut))
|
||||
- cppcheck fix for openjp2 [\#740](https://github.com/uclouvain/openjpeg/pull/740) ([julienmalik](https://github.com/julienmalik))
|
||||
- Fix uninitialized variable reported by cppcheck [\#735](https://github.com/uclouvain/openjpeg/pull/735) ([julienmalik](https://github.com/julienmalik))
|
||||
- Remove dead code in opj\_dump [\#734](https://github.com/uclouvain/openjpeg/pull/734) ([julienmalik](https://github.com/julienmalik))
|
||||
- issue \#695 MQ Encode: ensure that bp pointer never points to uninitialized memory [\#708](https://github.com/uclouvain/openjpeg/pull/708) ([boxerab](https://github.com/boxerab))
|
||||
- Fix issue 135 [\#706](https://github.com/uclouvain/openjpeg/pull/706) ([mayeut](https://github.com/mayeut))
|
||||
- Fix implementation of opj\_calloc [\#705](https://github.com/uclouvain/openjpeg/pull/705) ([stweil](https://github.com/stweil))
|
||||
- \[git/2.1 regression\] Fix opj\_write\_tile\(\) failure when numresolutions=1 [\#690](https://github.com/uclouvain/openjpeg/pull/690) ([rouault](https://github.com/rouault))
|
||||
- Fix fatal crash on 64 bit Linux [\#687](https://github.com/uclouvain/openjpeg/pull/687) ([stweil](https://github.com/stweil))
|
||||
- \[libtiff\] Add missing include statement for ssize\_t [\#686](https://github.com/uclouvain/openjpeg/pull/686) ([mayeut](https://github.com/mayeut))
|
||||
- Fix duplicate article in comments [\#684](https://github.com/uclouvain/openjpeg/pull/684) ([stweil](https://github.com/stweil))
|
||||
- Fix grammar in comment [\#679](https://github.com/uclouvain/openjpeg/pull/679) ([stweil](https://github.com/stweil))
|
||||
- Remove whitespace and CR at line endings [\#678](https://github.com/uclouvain/openjpeg/pull/678) ([stweil](https://github.com/stweil))
|
||||
- Fix typos [\#665](https://github.com/uclouvain/openjpeg/pull/665) ([jwilk](https://github.com/jwilk))
|
||||
- Add missing source for the JPIP library and executables \(issue \#658\) [\#659](https://github.com/uclouvain/openjpeg/pull/659) ([stweil](https://github.com/stweil))
|
||||
- Fix undefined size jp2 box handling [\#654](https://github.com/uclouvain/openjpeg/pull/654) ([mayeut](https://github.com/mayeut))
|
||||
- opj\_decompress: Update error message [\#651](https://github.com/uclouvain/openjpeg/pull/651) ([stweil](https://github.com/stweil))
|
||||
- Fix support of posix\_memalloc for Linux [\#648](https://github.com/uclouvain/openjpeg/pull/648) ([stweil](https://github.com/stweil))
|
||||
- Fix typo in comments [\#647](https://github.com/uclouvain/openjpeg/pull/647) ([stweil](https://github.com/stweil))
|
||||
- Avoid pointer arithmetic with \(void \*\) pointers [\#644](https://github.com/uclouvain/openjpeg/pull/644) ([smuehlst](https://github.com/smuehlst))
|
||||
- Fix HP compiler warning about redeclaration of function \(\#640\) [\#641](https://github.com/uclouvain/openjpeg/pull/641) ([smuehlst](https://github.com/smuehlst))
|
||||
- Fix format strings and unneeded assignment [\#638](https://github.com/uclouvain/openjpeg/pull/638) ([stweil](https://github.com/stweil))
|
||||
- Fix repository for JPEG2000 test data [\#637](https://github.com/uclouvain/openjpeg/pull/637) ([stweil](https://github.com/stweil))
|
||||
- Update allocation functions [\#636](https://github.com/uclouvain/openjpeg/pull/636) ([mayeut](https://github.com/mayeut))
|
||||
- Fix OpenJPEG GitHub issue \#633. [\#634](https://github.com/uclouvain/openjpeg/pull/634) ([smuehlst](https://github.com/smuehlst))
|
||||
- travis-ci: Include add ons in matrix [\#632](https://github.com/uclouvain/openjpeg/pull/632) ([mayeut](https://github.com/mayeut))
|
||||
- Add Appveyor [\#627](https://github.com/uclouvain/openjpeg/pull/627) ([mayeut](https://github.com/mayeut))
|
||||
- Use Travis-ci to run ABI check [\#626](https://github.com/uclouvain/openjpeg/pull/626) ([mayeut](https://github.com/mayeut))
|
||||
- Fix warnings for C++ [\#623](https://github.com/uclouvain/openjpeg/pull/623) ([stweil](https://github.com/stweil))
|
||||
- Fixed problem that C++ compilation failed because of enum variable. [\#622](https://github.com/uclouvain/openjpeg/pull/622) ([smuehlst](https://github.com/smuehlst))
|
||||
- Added missing casts for return values of opj\_malloc\(\)/opj\_calloc\(\). [\#618](https://github.com/uclouvain/openjpeg/pull/618) ([smuehlst](https://github.com/smuehlst))
|
||||
- Add check for seek support before trying TPsot==TNsot workaround [\#617](https://github.com/uclouvain/openjpeg/pull/617) ([mayeut](https://github.com/mayeut))
|
||||
- Fix some typos found by codespell [\#610](https://github.com/uclouvain/openjpeg/pull/610) ([stweil](https://github.com/stweil))
|
||||
- Correct leak in color\_cielab\_to\_rgb [\#590](https://github.com/uclouvain/openjpeg/pull/590) ([mayeut](https://github.com/mayeut))
|
||||
- Add Travis-ci build matrix [\#584](https://github.com/uclouvain/openjpeg/pull/584) ([mayeut](https://github.com/mayeut))
|
||||
- Correct lossless issue on linux x86 [\#579](https://github.com/uclouvain/openjpeg/pull/579) ([mayeut](https://github.com/mayeut))
|
||||
- Travis-ci update [\#578](https://github.com/uclouvain/openjpeg/pull/578) ([mayeut](https://github.com/mayeut))
|
||||
- Correct CMake version requirements [\#572](https://github.com/uclouvain/openjpeg/pull/572) ([mayeut](https://github.com/mayeut))
|
||||
- Add tests for CMYK/esYCC/CIELab [\#567](https://github.com/uclouvain/openjpeg/pull/567) ([mayeut](https://github.com/mayeut))
|
||||
- Add support for CIELab, EYCC and CMYK [\#559](https://github.com/uclouvain/openjpeg/pull/559) ([szukw000](https://github.com/szukw000))
|
||||
- Remove printf/fprintf to stdout/stderr throughout openjp2 lib [\#558](https://github.com/uclouvain/openjpeg/pull/558) ([mayeut](https://github.com/mayeut))
|
||||
- better -ffast-math handling [\#555](https://github.com/uclouvain/openjpeg/pull/555) ([rdieter](https://github.com/rdieter))
|
||||
- Add jpylyzer tests for JP2 compression [\#552](https://github.com/uclouvain/openjpeg/pull/552) ([mayeut](https://github.com/mayeut))
|
||||
- Add COC/QCC in main header when needed [\#551](https://github.com/uclouvain/openjpeg/pull/551) ([mayeut](https://github.com/mayeut))
|
||||
- Use \_\_emul under msvc x86 for fast 64 = 32 \* 32 [\#550](https://github.com/uclouvain/openjpeg/pull/550) ([mayeut](https://github.com/mayeut))
|
||||
- Update convert for PNG output [\#549](https://github.com/uclouvain/openjpeg/pull/549) ([mayeut](https://github.com/mayeut))
|
||||
- Remove some warnings when building [\#548](https://github.com/uclouvain/openjpeg/pull/548) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libpng-1.6.17 [\#547](https://github.com/uclouvain/openjpeg/pull/547) ([mayeut](https://github.com/mayeut))
|
||||
- Add some missing static keywords [\#545](https://github.com/uclouvain/openjpeg/pull/545) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 [\#544](https://github.com/uclouvain/openjpeg/pull/544) ([mayeut](https://github.com/mayeut))
|
||||
- Prevent overflow when coding 16 bits images [\#543](https://github.com/uclouvain/openjpeg/pull/543) ([mayeut](https://github.com/mayeut))
|
||||
- Switch to libcms2-2.6 [\#542](https://github.com/uclouvain/openjpeg/pull/542) ([mayeut](https://github.com/mayeut))
|
||||
- Update PNG support [\#538](https://github.com/uclouvain/openjpeg/pull/538) ([mayeut](https://github.com/mayeut))
|
||||
- Various Minor fixes [\#537](https://github.com/uclouvain/openjpeg/pull/537) ([mayeut](https://github.com/mayeut))
|
||||
- Update TIFF conversion to support more bit depth. [\#535](https://github.com/uclouvain/openjpeg/pull/535) ([mayeut](https://github.com/mayeut))
|
||||
- Add checks for odd looking cmap & for cmap outside jp2h box [\#534](https://github.com/uclouvain/openjpeg/pull/534) ([mayeut](https://github.com/mayeut))
|
||||
- Refactor opj\_j2k\_read\_ppm & opj\_j2k\_read\_ppt [\#533](https://github.com/uclouvain/openjpeg/pull/533) ([mayeut](https://github.com/mayeut))
|
||||
- Add option to force component splitting in imagetopnm [\#531](https://github.com/uclouvain/openjpeg/pull/531) ([mayeut](https://github.com/mayeut))
|
||||
- fix Suspicious code in j2k.c \#517 [\#529](https://github.com/uclouvain/openjpeg/pull/529) ([renevanderark](https://github.com/renevanderark))
|
||||
- Update zlib to version 1.2.8 [\#528](https://github.com/uclouvain/openjpeg/pull/528) ([mayeut](https://github.com/mayeut))
|
||||
- Fix opj\_write\_bytes\_BE \(\#518\) [\#521](https://github.com/uclouvain/openjpeg/pull/521) ([manisandro](https://github.com/manisandro))
|
||||
- Correctly decode files with incorrect tile-part header fields \(TPsot==TNsot\) [\#514](https://github.com/uclouvain/openjpeg/pull/514) ([mayeut](https://github.com/mayeut))
|
||||
- Fixed typos [\#510](https://github.com/uclouvain/openjpeg/pull/510) ([radarhere](https://github.com/radarhere))
|
||||
- Formatted the readme file [\#507](https://github.com/uclouvain/openjpeg/pull/507) ([htmfilho](https://github.com/htmfilho))
|
||||
|
||||
## [version.2.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.1) (2014-04-29)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0.1...version.2.1)
|
||||
|
||||
## [version.2.0.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0.1) (2014-04-22)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.2...version.2.0.1)
|
||||
|
||||
## [version.1.5.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.2) (2014-03-28)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0...version.1.5.2)
|
||||
|
||||
## [version.2.0](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0) (2014-03-28)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.1...version.2.0)
|
||||
|
||||
## [version.1.5.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.1) (2012-09-13)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5...version.1.5.1)
|
||||
|
||||
## [version.1.5](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5) (2012-02-07)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.3...version.1.5)
|
||||
|
||||
## [version.1.3](https://github.com/uclouvain/openjpeg/releases/tag/version.1.3) (2011-07-03)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.4...version.1.3)
|
||||
|
||||
## [version.1.4](https://github.com/uclouvain/openjpeg/releases/tag/version.1.4) (2011-07-03)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.2...version.1.4)
|
||||
|
||||
## [version.1.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.2) (2007-06-04)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.1...version.1.2)
|
||||
|
||||
## [version.1.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.1) (2007-01-31)
|
||||
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.0...version.1.1)
|
||||
|
||||
|
||||
|
||||
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
||||
Vendored
+193
@@ -0,0 +1,193 @@
|
||||
# Build scripts are adopted to OpenCV project
|
||||
# Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org)
|
||||
# Written by Mathieu Malaterre
|
||||
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
if(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
|
||||
set(OPENJPEG_LIBRARY_NAME libopenjp2)
|
||||
|
||||
project(openjpeg C)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
set(OPENJPEG_VERSION_MAJOR 2)
|
||||
set(OPENJPEG_VERSION_MINOR 3)
|
||||
set(OPENJPEG_VERSION_BUILD 1)
|
||||
set(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
set(PACKAGE_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
|
||||
# Because autotools does not support X.Y notation for SOVERSION, we have to use
|
||||
# two numbering, one for the openjpeg version and one for openjpeg soversion
|
||||
# version | soversion
|
||||
# 1.0 | 0
|
||||
# 1.1 | 1
|
||||
# 1.2 | 2
|
||||
# 1.3 | 3
|
||||
# 1.4 | 4
|
||||
# 1.5 | 5
|
||||
# 1.5.1 | 5
|
||||
# 2.0 | 6
|
||||
# 2.0.1 | 6
|
||||
# 2.1 | 7
|
||||
# 2.1.1 | 7
|
||||
# 2.1.2 | 7
|
||||
# 2.2.0 | 7
|
||||
# 2.3.0 | 7
|
||||
# 2.3.1 | 7
|
||||
# above is the recommendation by the OPJ team. If you really need to override this default,
|
||||
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
|
||||
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
|
||||
if(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_SOVERSION 7)
|
||||
endif()
|
||||
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||
)
|
||||
|
||||
set(OPENJPEG_BUILD "opencv-${OPENCV_VERSION}-openjp2-${OPENJPEG_VERSION}")
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(OPENJPEG_BUILD "${OPENJPEG_BUILD}-debug")
|
||||
endif()
|
||||
|
||||
message(STATUS "OpenJPEG: VERSION = ${OPENJPEG_VERSION}, BUILD = ${OPENJPEG_BUILD}")
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||
# warnings
|
||||
if(WIN32)
|
||||
if(NOT BORLAND)
|
||||
if(NOT CYGWIN)
|
||||
if(NOT MINGW)
|
||||
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
add_definitions(
|
||||
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
||||
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
||||
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_CRT_SECURE_NO_DEPRECATE_GLOBALS
|
||||
-D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
|
||||
-D_CRT_TIME_FUNCTIONS_NO_DEPRECATE
|
||||
-D_CRT_VCCLRIT_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Big endian test:
|
||||
include(TestBigEndian)
|
||||
test_big_endian(OPJ_BIG_ENDIAN)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (1/2)
|
||||
|
||||
# Check if some include files are provided by the system
|
||||
# These files are mandatory, so if they are not provided OpenJPEG library can't be built
|
||||
include(CheckIncludeFile)
|
||||
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
|
||||
check_include_file(${INCLUDE_FILENAME} ${VARIABLE_NAME})
|
||||
if(NOT ${VARIABLE_NAME})
|
||||
if(${MANDATORY_STATUS})
|
||||
message(STATUS "The file '${INCLUDE_FILENAME}' is mandatory for OpenJPEG build, but not found on your system")
|
||||
return()
|
||||
else()
|
||||
message(STATUS "The file '${INCLUDE_FILENAME}' is optional for OpenJPEG build and not found on your system."
|
||||
" Internal implementation will be used.")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
ensure_file_include("string.h" HAVE_STRING_H YES)
|
||||
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
|
||||
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
|
||||
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
|
||||
ensure_file_include("math.h" HAVE_MATH_H YES)
|
||||
ensure_file_include("float.h" HAVE_FLOAT_H YES)
|
||||
ensure_file_include("time.h" HAVE_TIME_H YES)
|
||||
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
|
||||
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
|
||||
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
|
||||
|
||||
# For the following files, we provide an alternative, they are not mandatory
|
||||
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
|
||||
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
|
||||
|
||||
# why check this one ? for openjpip ?
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
|
||||
# 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(_prev_CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
|
||||
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS ${_prev_CMAKE_REQUIRED_DEFINITIONS})
|
||||
unset(_prev_CMAKE_REQUIRED_DEFINITIONS)
|
||||
# memalign (obsolete)
|
||||
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (2/2)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/openjp2/opj_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openjp2/opj_config.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/openjp2/opj_config_private.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openjp2/opj_config_private.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
add_subdirectory(openjp2)
|
||||
|
||||
set_target_properties(${OPENJPEG_LIBRARY_NAME}
|
||||
PROPERTIES
|
||||
OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
COMPILE_PDB_NAME ${OPENJPEG_LIBRARY_NAME}
|
||||
COMPILE_PDB_NAME_DEBUG "${OPENJPEG_LIBRARY_NAME}${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(${OPENJPEG_LIBRARY_NAME}
|
||||
PROPERTIES
|
||||
FOLDER "3rdparty"
|
||||
)
|
||||
endif()
|
||||
|
||||
ocv_install_3rdparty_licenses(${OPENJPEG_LIBRARY_NAME} README.md LICENSE)
|
||||
|
||||
# Setting all necessary variables
|
||||
set(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY_NAME} PARENT_SCOPE)
|
||||
set(OPENJPEG_VERSION ${OPENJPEG_VERSION} PARENT_SCOPE)
|
||||
set(OPENJPEG_MAJOR_VERSION ${OPENJPEG_VERSION_MAJOR} PARENT_SCOPE)
|
||||
set(OPENJPEG_MINOR_VERSION ${OPENJPEG_VERSION_MINOR} PARENT_SCOPE)
|
||||
set(OPENJPEG_BUILD_VERSION ${OPENJPEG_VERSION_BUILD} PARENT_SCOPE)
|
||||
get_target_property(_openjpeg_include_dirs ${OPENJPEG_LIBRARY_NAME} INCLUDE_DIRECTORIES)
|
||||
set(OPENJPEG_INCLUDE_DIRS ${_openjpeg_include_dirs} PARENT_SCOPE)
|
||||
|
||||
# OpenJPEG can't be built only if configuration script doesn't encounter any problem
|
||||
if(NOT DEFINED OCV_CAN_BUILD_OPENJPEG)
|
||||
# all prerequisites are fulfilled
|
||||
set(OCV_CAN_BUILD_OPENJPEG TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2009, Francois-Olivier Devaux
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
|
||||
# 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
|
||||
* scripts: scripts for developers
|
||||
|
||||
See [LICENSE][link-license] for license and copyright information.
|
||||
|
||||
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
|
||||
|
||||
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
|
||||
|
||||
## 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"
|
||||
Vendored
+39
@@ -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
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
# Defines the source code for the library
|
||||
set(OPENJPEG_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bio.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cio.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dwt.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/event.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/invert.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/j2k.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jp2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mct.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mqc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/openjpeg.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_clock.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pi.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/t1.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/t2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sparse_array.c
|
||||
)
|
||||
|
||||
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()
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wstrict-prototypes -Wcast-function-type)
|
||||
|
||||
add_library(${OPENJPEG_LIBRARY_NAME} STATIC ${OPENJPEG_SRCS})
|
||||
|
||||
target_compile_definitions(${OPENJPEG_LIBRARY_NAME} PUBLIC OPJ_STATIC)
|
||||
|
||||
ocv_include_directories("${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(${OPENJPEG_LIBRARY_NAME} PRIVATE m)
|
||||
endif()
|
||||
|
||||
set_target_properties(${OPENJPEG_LIBRARY_NAME}
|
||||
PROPERTIES
|
||||
${OPENJPEG_LIBRARY_PROPERTIES}
|
||||
)
|
||||
|
||||
#################################################################################
|
||||
# threading configuration
|
||||
#################################################################################
|
||||
|
||||
option(OPJ_USE_THREAD "Build with thread/mutex support " ON)
|
||||
if(NOT OPJ_USE_THREAD)
|
||||
add_definitions(-DMUTEX_stub)
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT )
|
||||
add_definitions(-DMUTEX_pthread)
|
||||
endif()
|
||||
|
||||
if(OPJ_USE_THREAD AND NOT Threads_FOUND)
|
||||
message(STATUS "No thread library found and thread/mutex support is required by OPJ_USE_THREAD option")
|
||||
set(OCV_CAN_BUILD_OPENJPEG FALSE PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
|
||||
target_link_libraries(${OPENJPEG_LIBRARY_NAME} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
ocv_install_target(${OPENJPEG_LIBRARY_NAME}
|
||||
EXPORT OpenCVModules
|
||||
ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev
|
||||
)
|
||||
endif()
|
||||
Vendored
+217
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/** @defgroup BIO BIO - Individual bit input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/** @name Local static functions */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Write a bit
|
||||
@param bio BIO handle
|
||||
@param b Bit to write (0 or 1)
|
||||
*/
|
||||
static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b);
|
||||
/**
|
||||
Read a bit
|
||||
@param bio BIO handle
|
||||
@return Returns the read bit
|
||||
*/
|
||||
static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio);
|
||||
/**
|
||||
Write a byte
|
||||
@param bio BIO handle
|
||||
@return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise
|
||||
*/
|
||||
static OPJ_BOOL opj_bio_byteout(opj_bio_t *bio);
|
||||
/**
|
||||
Read a byte
|
||||
@param bio BIO handle
|
||||
@return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise
|
||||
*/
|
||||
static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio);
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
local functions
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
static OPJ_BOOL opj_bio_byteout(opj_bio_t *bio)
|
||||
{
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
*bio->bp++ = (OPJ_BYTE)(bio->buf >> 8);
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio)
|
||||
{
|
||||
bio->buf = (bio->buf << 8) & 0xffff;
|
||||
bio->ct = bio->buf == 0xff00 ? 7 : 8;
|
||||
if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
bio->buf |= *bio->bp++;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
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 ? */
|
||||
}
|
||||
bio->ct--;
|
||||
bio->buf |= b << bio->ct;
|
||||
}
|
||||
|
||||
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 ? */
|
||||
}
|
||||
bio->ct--;
|
||||
return (bio->buf >> bio->ct) & 1;
|
||||
}
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Bit Input/Output interface
|
||||
==========================================================
|
||||
*/
|
||||
|
||||
opj_bio_t* opj_bio_create(void)
|
||||
{
|
||||
opj_bio_t *bio = (opj_bio_t*)opj_malloc(sizeof(opj_bio_t));
|
||||
return bio;
|
||||
}
|
||||
|
||||
void opj_bio_destroy(opj_bio_t *bio)
|
||||
{
|
||||
if (bio) {
|
||||
opj_free(bio);
|
||||
}
|
||||
}
|
||||
|
||||
ptrdiff_t opj_bio_numbytes(opj_bio_t *bio)
|
||||
{
|
||||
return (bio->bp - bio->start);
|
||||
}
|
||||
|
||||
void opj_bio_init_enc(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len)
|
||||
{
|
||||
bio->start = bp;
|
||||
bio->end = bp + len;
|
||||
bio->bp = bp;
|
||||
bio->buf = 0;
|
||||
bio->ct = 8;
|
||||
}
|
||||
|
||||
void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len)
|
||||
{
|
||||
bio->start = bp;
|
||||
bio->end = bp + len;
|
||||
bio->bp = bp;
|
||||
bio->buf = 0;
|
||||
bio->ct = 0;
|
||||
}
|
||||
|
||||
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_INT32 i;
|
||||
|
||||
assert((n > 0U) && (n <= 32U));
|
||||
for (i = (OPJ_INT32)n - 1; i >= 0; i--) {
|
||||
opj_bio_putbit(bio, (v >> i) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n)
|
||||
{
|
||||
OPJ_INT32 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 = (OPJ_INT32)n - 1; i >= 0; i--) {
|
||||
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)
|
||||
{
|
||||
if (! opj_bio_byteout(bio)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (bio->ct == 7) {
|
||||
if (! opj_bio_byteout(bio)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_bio_inalign(opj_bio_t *bio)
|
||||
{
|
||||
if ((bio->buf & 0xff) == 0xff) {
|
||||
if (! opj_bio_bytein(bio)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
bio->ct = 0;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPJ_BIO_H
|
||||
#define OPJ_BIO_H
|
||||
|
||||
#include <stddef.h> /* ptrdiff_t */
|
||||
|
||||
/**
|
||||
@file bio.h
|
||||
@brief Implementation of an individual bit input-output (BIO)
|
||||
|
||||
The functions in BIO.C have for goal to realize an individual bit input - output.
|
||||
*/
|
||||
|
||||
/** @defgroup BIO BIO - Individual bit input-output stream */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
Individual bit input-output stream (BIO)
|
||||
*/
|
||||
typedef struct opj_bio {
|
||||
/** pointer to the start of the buffer */
|
||||
OPJ_BYTE *start;
|
||||
/** pointer to the end of the buffer */
|
||||
OPJ_BYTE *end;
|
||||
/** pointer to the present position in the buffer */
|
||||
OPJ_BYTE *bp;
|
||||
/** temporary place where each byte is read or written */
|
||||
OPJ_UINT32 buf;
|
||||
/** coder : number of bits free to write. decoder : number of bits read */
|
||||
OPJ_UINT32 ct;
|
||||
} opj_bio_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
Create a new BIO handle
|
||||
@return Returns a new BIO handle if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_bio_t* opj_bio_create(void);
|
||||
/**
|
||||
Destroy a previously created BIO handle
|
||||
@param bio BIO handle to destroy
|
||||
*/
|
||||
void opj_bio_destroy(opj_bio_t *bio);
|
||||
/**
|
||||
Number of bytes written.
|
||||
@param bio BIO handle
|
||||
@return Returns the number of bytes written
|
||||
*/
|
||||
ptrdiff_t opj_bio_numbytes(opj_bio_t *bio);
|
||||
/**
|
||||
Init encoder
|
||||
@param bio BIO handle
|
||||
@param bp Output buffer
|
||||
@param len Output buffer length
|
||||
*/
|
||||
void opj_bio_init_enc(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len);
|
||||
/**
|
||||
Init decoder
|
||||
@param bio BIO handle
|
||||
@param bp Input buffer
|
||||
@param len Input buffer length
|
||||
*/
|
||||
void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len);
|
||||
/**
|
||||
Write bits
|
||||
@param bio BIO handle
|
||||
@param v Value of bits
|
||||
@param n Number of bits to write
|
||||
*/
|
||||
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n);
|
||||
/**
|
||||
Read bits
|
||||
@param bio BIO handle
|
||||
@param n Number of bits to read
|
||||
@return Returns the corresponding read number
|
||||
*/
|
||||
OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n);
|
||||
/**
|
||||
Flush bits
|
||||
@param bio BIO handle
|
||||
@return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise
|
||||
*/
|
||||
OPJ_BOOL opj_bio_flush(opj_bio_t *bio);
|
||||
/**
|
||||
Passes the ending bits (coming from flushing)
|
||||
@param bio BIO handle
|
||||
@return Returns OPJ_TRUE if successful, returns OPJ_FALSE otherwise
|
||||
*/
|
||||
OPJ_BOOL opj_bio_inalign(opj_bio_t *bio);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_BIO_H */
|
||||
|
||||
Vendored
+683
@@ -0,0 +1,683 @@
|
||||
/*
|
||||
* 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, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
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) + sizeof(
|
||||
OPJ_UINT32) - p_nb_bytes;
|
||||
|
||||
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
|
||||
|
||||
memcpy(p_buffer, l_data_ptr, p_nb_bytes);
|
||||
}
|
||||
|
||||
void opj_write_bytes_LE(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 - 1;
|
||||
OPJ_UINT32 i;
|
||||
|
||||
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
|
||||
|
||||
for (i = 0; i < p_nb_bytes; ++i) {
|
||||
*(p_buffer++) = *(l_data_ptr--);
|
||||
}
|
||||
}
|
||||
|
||||
void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value,
|
||||
OPJ_UINT32 p_nb_bytes)
|
||||
{
|
||||
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value);
|
||||
|
||||
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
|
||||
|
||||
*p_value = 0;
|
||||
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)
|
||||
{
|
||||
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + p_nb_bytes - 1;
|
||||
OPJ_UINT32 i;
|
||||
|
||||
assert(p_nb_bytes > 0 && p_nb_bytes <= sizeof(OPJ_UINT32));
|
||||
|
||||
*p_value = 0;
|
||||
for (i = 0; i < p_nb_bytes; ++i) {
|
||||
*(l_data_ptr--) = *(p_buffer++);
|
||||
}
|
||||
}
|
||||
|
||||
void opj_write_double_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
|
||||
{
|
||||
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value);
|
||||
memcpy(p_buffer, l_data_ptr, sizeof(OPJ_FLOAT64));
|
||||
}
|
||||
|
||||
void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
|
||||
{
|
||||
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + sizeof(
|
||||
OPJ_FLOAT64) - 1;
|
||||
OPJ_UINT32 i;
|
||||
for (i = 0; i < sizeof(OPJ_FLOAT64); ++i) {
|
||||
*(p_buffer++) = *(l_data_ptr--);
|
||||
}
|
||||
}
|
||||
|
||||
void opj_read_double_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value)
|
||||
{
|
||||
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value);
|
||||
memcpy(l_data_ptr, p_buffer, sizeof(OPJ_FLOAT64));
|
||||
}
|
||||
|
||||
void opj_read_double_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value)
|
||||
{
|
||||
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + sizeof(OPJ_FLOAT64) - 1;
|
||||
OPJ_UINT32 i;
|
||||
for (i = 0; i < sizeof(OPJ_FLOAT64); ++i) {
|
||||
*(l_data_ptr--) = *(p_buffer++);
|
||||
}
|
||||
}
|
||||
|
||||
void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value)
|
||||
{
|
||||
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value);
|
||||
memcpy(p_buffer, l_data_ptr, sizeof(OPJ_FLOAT32));
|
||||
}
|
||||
|
||||
void opj_write_float_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value)
|
||||
{
|
||||
const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + sizeof(
|
||||
OPJ_FLOAT32) - 1;
|
||||
OPJ_UINT32 i;
|
||||
for (i = 0; i < sizeof(OPJ_FLOAT32); ++i) {
|
||||
*(p_buffer++) = *(l_data_ptr--);
|
||||
}
|
||||
}
|
||||
|
||||
void opj_read_float_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value)
|
||||
{
|
||||
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value);
|
||||
memcpy(l_data_ptr, p_buffer, sizeof(OPJ_FLOAT32));
|
||||
}
|
||||
|
||||
void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value)
|
||||
{
|
||||
OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + sizeof(OPJ_FLOAT32) - 1;
|
||||
OPJ_UINT32 i;
|
||||
for (i = 0; i < sizeof(OPJ_FLOAT32); ++i) {
|
||||
*(l_data_ptr--) = *(p_buffer++);
|
||||
}
|
||||
}
|
||||
|
||||
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_calloc(1, sizeof(opj_stream_private_t));
|
||||
if (! l_stream) {
|
||||
return 00;
|
||||
}
|
||||
|
||||
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) {
|
||||
opj_free(l_stream);
|
||||
return 00;
|
||||
}
|
||||
|
||||
l_stream->m_current_data = l_stream->m_stored_data;
|
||||
|
||||
if (l_is_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_STATUS_OUTPUT;
|
||||
l_stream->m_opj_skip = opj_stream_write_skip;
|
||||
l_stream->m_opj_seek = opj_stream_write_seek;
|
||||
}
|
||||
|
||||
l_stream->m_read_fn = opj_stream_default_read;
|
||||
l_stream->m_write_fn = opj_stream_default_write;
|
||||
l_stream->m_skip_fn = opj_stream_default_skip;
|
||||
l_stream->m_seek_fn = opj_stream_default_seek;
|
||||
|
||||
return (opj_stream_t *) l_stream;
|
||||
}
|
||||
|
||||
opj_stream_t* OPJ_CALLCONV opj_stream_default_create(OPJ_BOOL l_is_input)
|
||||
{
|
||||
return opj_stream_create(OPJ_J2K_STREAM_CHUNK_SIZE, l_is_input);
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if (l_stream) {
|
||||
if (l_stream->m_free_user_data_fn) {
|
||||
l_stream->m_free_user_data_fn(l_stream->m_user_data);
|
||||
}
|
||||
opj_free(l_stream->m_stored_data);
|
||||
l_stream->m_stored_data = 00;
|
||||
opj_free(l_stream);
|
||||
}
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream,
|
||||
opj_stream_read_fn p_function)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if ((!l_stream) || (!(l_stream->m_status & OPJ_STREAM_STATUS_INPUT))) {
|
||||
return;
|
||||
}
|
||||
|
||||
l_stream->m_read_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream,
|
||||
opj_stream_seek_fn p_function)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if (!l_stream) {
|
||||
return;
|
||||
}
|
||||
l_stream->m_seek_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream,
|
||||
opj_stream_write_fn p_function)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if ((!l_stream) || (!(l_stream->m_status & OPJ_STREAM_STATUS_OUTPUT))) {
|
||||
return;
|
||||
}
|
||||
|
||||
l_stream->m_write_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream,
|
||||
opj_stream_skip_fn p_function)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if (! l_stream) {
|
||||
return;
|
||||
}
|
||||
|
||||
l_stream->m_skip_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_user_data(opj_stream_t* p_stream,
|
||||
void * p_data, opj_stream_free_user_data_fn p_function)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
if (!l_stream) {
|
||||
return;
|
||||
}
|
||||
l_stream->m_user_data = p_data;
|
||||
l_stream->m_free_user_data_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream,
|
||||
OPJ_UINT64 data_length)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
if (!l_stream) {
|
||||
return;
|
||||
}
|
||||
l_stream->m_user_data_length = data_length;
|
||||
}
|
||||
|
||||
OPJ_SIZE_T opj_stream_read_data(opj_stream_private_t * p_stream,
|
||||
OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
OPJ_SIZE_T l_read_nb_bytes = 0;
|
||||
if (p_stream->m_bytes_in_buffer >= p_size) {
|
||||
memcpy(p_buffer, p_stream->m_current_data, p_size);
|
||||
p_stream->m_current_data += p_size;
|
||||
p_stream->m_bytes_in_buffer -= p_size;
|
||||
l_read_nb_bytes += p_size;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
|
||||
return l_read_nb_bytes;
|
||||
}
|
||||
|
||||
/* we are now in the case when the remaining data if not sufficient */
|
||||
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;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
|
||||
}
|
||||
|
||||
/* the flag is not set, we copy data and then do an actual read on the stream */
|
||||
if (p_stream->m_bytes_in_buffer) {
|
||||
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_stored_data;
|
||||
p_buffer += p_stream->m_bytes_in_buffer;
|
||||
p_size -= p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
} else {
|
||||
/* case where we are already at the end of the buffer
|
||||
so reset the m_current_data to point to the start of the
|
||||
stored buffer to get ready to read from disk*/
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
}
|
||||
|
||||
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 */
|
||||
p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_stream->m_stored_data,
|
||||
p_stream->m_buffer_size, p_stream->m_user_data);
|
||||
|
||||
if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T) - 1) {
|
||||
/* end of stream */
|
||||
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_STATUS_END;
|
||||
/* end of stream */
|
||||
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
|
||||
} else if (p_stream->m_bytes_in_buffer < p_size) {
|
||||
/* not enough data */
|
||||
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_stored_data;
|
||||
p_buffer += p_stream->m_bytes_in_buffer;
|
||||
p_size -= p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
} else {
|
||||
l_read_nb_bytes += p_size;
|
||||
memcpy(p_buffer, p_stream->m_current_data, p_size);
|
||||
p_stream->m_current_data += p_size;
|
||||
p_stream->m_bytes_in_buffer -= p_size;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
|
||||
return l_read_nb_bytes;
|
||||
}
|
||||
} else {
|
||||
/* direct read on the dest buffer */
|
||||
p_stream->m_bytes_in_buffer = p_stream->m_read_fn(p_buffer, p_size,
|
||||
p_stream->m_user_data);
|
||||
|
||||
if (p_stream->m_bytes_in_buffer == (OPJ_SIZE_T) - 1) {
|
||||
/* end of stream */
|
||||
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_STATUS_END;
|
||||
/* end of stream */
|
||||
return l_read_nb_bytes ? l_read_nb_bytes : (OPJ_SIZE_T) - 1;
|
||||
} else if (p_stream->m_bytes_in_buffer < p_size) {
|
||||
/* not enough data */
|
||||
l_read_nb_bytes += p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
p_buffer += p_stream->m_bytes_in_buffer;
|
||||
p_size -= p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
} else {
|
||||
/* we have read the exact size */
|
||||
l_read_nb_bytes += p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
return l_read_nb_bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OPJ_SIZE_T opj_stream_write_data(opj_stream_private_t * p_stream,
|
||||
const OPJ_BYTE * p_buffer,
|
||||
OPJ_SIZE_T p_size,
|
||||
opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
OPJ_SIZE_T l_remaining_bytes = 0;
|
||||
OPJ_SIZE_T l_write_nb_bytes = 0;
|
||||
|
||||
if (p_stream->m_status & OPJ_STREAM_STATUS_ERROR) {
|
||||
return (OPJ_SIZE_T) - 1;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
l_remaining_bytes = p_stream->m_buffer_size - p_stream->m_bytes_in_buffer;
|
||||
|
||||
/* we have more memory than required */
|
||||
if (l_remaining_bytes >= p_size) {
|
||||
memcpy(p_stream->m_current_data, p_buffer, p_size);
|
||||
|
||||
p_stream->m_current_data += p_size;
|
||||
p_stream->m_bytes_in_buffer += p_size;
|
||||
l_write_nb_bytes += p_size;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)p_size;
|
||||
|
||||
return l_write_nb_bytes;
|
||||
}
|
||||
|
||||
/* we copy data and then do an actual read on the stream */
|
||||
if (l_remaining_bytes) {
|
||||
l_write_nb_bytes += l_remaining_bytes;
|
||||
|
||||
memcpy(p_stream->m_current_data, p_buffer, l_remaining_bytes);
|
||||
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
|
||||
p_buffer += l_remaining_bytes;
|
||||
p_size -= l_remaining_bytes;
|
||||
p_stream->m_bytes_in_buffer += l_remaining_bytes;
|
||||
p_stream->m_byte_offset += (OPJ_OFF_T)l_remaining_bytes;
|
||||
}
|
||||
|
||||
if (! opj_stream_flush(p_stream, p_event_mgr)) {
|
||||
return (OPJ_SIZE_T) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_stream_flush(opj_stream_private_t * p_stream,
|
||||
opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
/* the number of bytes written on the media. */
|
||||
OPJ_SIZE_T l_current_write_nb_bytes = 0;
|
||||
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
|
||||
while (p_stream->m_bytes_in_buffer) {
|
||||
/* we should do an actual write on the media */
|
||||
l_current_write_nb_bytes = p_stream->m_write_fn(p_stream->m_current_data,
|
||||
p_stream->m_bytes_in_buffer,
|
||||
p_stream->m_user_data);
|
||||
|
||||
if (l_current_write_nb_bytes == (OPJ_SIZE_T) - 1) {
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_ERROR;
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Error on writing stream!\n");
|
||||
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
p_stream->m_current_data += l_current_write_nb_bytes;
|
||||
p_stream->m_bytes_in_buffer -= l_current_write_nb_bytes;
|
||||
}
|
||||
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_OFF_T opj_stream_read_skip(opj_stream_private_t * p_stream,
|
||||
OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
OPJ_OFF_T l_skip_nb_bytes = 0;
|
||||
OPJ_OFF_T l_current_skip_nb_bytes = 0;
|
||||
|
||||
assert(p_size >= 0);
|
||||
|
||||
if (p_stream->m_bytes_in_buffer >= (OPJ_SIZE_T)p_size) {
|
||||
p_stream->m_current_data += p_size;
|
||||
/* it is safe to cast p_size to OPJ_SIZE_T since it is <= m_bytes_in_buffer
|
||||
which is of type OPJ_SIZE_T */
|
||||
p_stream->m_bytes_in_buffer -= (OPJ_SIZE_T)p_size;
|
||||
l_skip_nb_bytes += p_size;
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
return l_skip_nb_bytes;
|
||||
}
|
||||
|
||||
/* we are now in the case when the remaining data if not sufficient */
|
||||
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;
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) - 1;
|
||||
}
|
||||
|
||||
/* the flag is not set, we copy data and then do an actual skip on the stream */
|
||||
if (p_stream->m_bytes_in_buffer) {
|
||||
l_skip_nb_bytes += (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
p_size -= (OPJ_OFF_T)p_stream->m_bytes_in_buffer;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
}
|
||||
|
||||
while (p_size > 0) {
|
||||
/* Check if we are going beyond the end of file. Most skip_fn do not */
|
||||
/* check that, but we must be careful not to advance m_byte_offset */
|
||||
/* beyond m_user_data_length, otherwise */
|
||||
/* opj_stream_get_number_byte_left() will assert. */
|
||||
if ((OPJ_UINT64)(p_stream->m_byte_offset + l_skip_nb_bytes + p_size) >
|
||||
p_stream->m_user_data_length) {
|
||||
opj_event_msg(p_event_mgr, EVT_INFO, "Stream reached its end !\n");
|
||||
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
l_skip_nb_bytes = (OPJ_OFF_T)(p_stream->m_user_data_length -
|
||||
(OPJ_UINT64)p_stream->m_byte_offset);
|
||||
|
||||
opj_stream_read_seek(p_stream, (OPJ_OFF_T)p_stream->m_user_data_length,
|
||||
p_event_mgr);
|
||||
p_stream->m_status |= OPJ_STREAM_STATUS_END;
|
||||
|
||||
/* end if stream */
|
||||
return l_skip_nb_bytes ? l_skip_nb_bytes : (OPJ_OFF_T) - 1;
|
||||
}
|
||||
|
||||
/* we should do an actual skip on the media */
|
||||
l_current_skip_nb_bytes = p_stream->m_skip_fn(p_size, p_stream->m_user_data);
|
||||
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_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;
|
||||
}
|
||||
p_size -= l_current_skip_nb_bytes;
|
||||
l_skip_nb_bytes += l_current_skip_nb_bytes;
|
||||
}
|
||||
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
|
||||
return l_skip_nb_bytes;
|
||||
}
|
||||
|
||||
OPJ_OFF_T opj_stream_write_skip(opj_stream_private_t * p_stream,
|
||||
OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
OPJ_BOOL l_is_written = 0;
|
||||
OPJ_OFF_T l_current_skip_nb_bytes = 0;
|
||||
OPJ_OFF_T l_skip_nb_bytes = 0;
|
||||
|
||||
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_STATUS_ERROR;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
return (OPJ_OFF_T) - 1;
|
||||
}
|
||||
/* then skip */
|
||||
|
||||
while (p_size > 0) {
|
||||
/* we should do an actual skip on the media */
|
||||
l_current_skip_nb_bytes = p_stream->m_skip_fn(p_size, p_stream->m_user_data);
|
||||
|
||||
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_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;
|
||||
}
|
||||
p_size -= l_current_skip_nb_bytes;
|
||||
l_skip_nb_bytes += l_current_skip_nb_bytes;
|
||||
}
|
||||
|
||||
p_stream->m_byte_offset += l_skip_nb_bytes;
|
||||
|
||||
return l_skip_nb_bytes;
|
||||
}
|
||||
|
||||
OPJ_OFF_T opj_stream_tell(const opj_stream_private_t * p_stream)
|
||||
{
|
||||
return p_stream->m_byte_offset;
|
||||
}
|
||||
|
||||
OPJ_OFF_T opj_stream_get_number_byte_left(const opj_stream_private_t * p_stream)
|
||||
{
|
||||
assert(p_stream->m_byte_offset >= 0);
|
||||
assert(p_stream->m_user_data_length >= (OPJ_UINT64)p_stream->m_byte_offset);
|
||||
return p_stream->m_user_data_length ?
|
||||
(OPJ_OFF_T)(p_stream->m_user_data_length) - p_stream->m_byte_offset :
|
||||
0;
|
||||
}
|
||||
|
||||
OPJ_OFF_T opj_stream_skip(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
|
||||
opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
assert(p_size >= 0);
|
||||
return p_stream->m_opj_skip(p_stream, p_size, p_event_mgr);
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_stream_read_seek(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
|
||||
opj_event_mgr_t * p_event_mgr)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(p_event_mgr);
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
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_STATUS_END;
|
||||
return OPJ_FALSE;
|
||||
} else {
|
||||
/* reset stream status */
|
||||
p_stream->m_status &= (~OPJ_STREAM_STATUS_END);
|
||||
p_stream->m_byte_offset = p_size;
|
||||
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
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_STATUS_ERROR;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
p_stream->m_current_data = p_stream->m_stored_data;
|
||||
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_STATUS_ERROR;
|
||||
return OPJ_FALSE;
|
||||
} else {
|
||||
p_stream->m_byte_offset = p_size;
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_stream_seek(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
|
||||
struct opj_event_mgr * p_event_mgr)
|
||||
{
|
||||
assert(p_size >= 0);
|
||||
return p_stream->m_opj_seek(p_stream, p_size, p_event_mgr);
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_stream_has_seek(const opj_stream_private_t * p_stream)
|
||||
{
|
||||
return p_stream->m_seek_fn != opj_stream_default_seek;
|
||||
}
|
||||
|
||||
OPJ_SIZE_T opj_stream_default_read(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
|
||||
void * p_user_data)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(p_buffer);
|
||||
OPJ_ARG_NOT_USED(p_nb_bytes);
|
||||
OPJ_ARG_NOT_USED(p_user_data);
|
||||
return (OPJ_SIZE_T) - 1;
|
||||
}
|
||||
|
||||
OPJ_SIZE_T opj_stream_default_write(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
|
||||
void * p_user_data)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(p_buffer);
|
||||
OPJ_ARG_NOT_USED(p_nb_bytes);
|
||||
OPJ_ARG_NOT_USED(p_user_data);
|
||||
return (OPJ_SIZE_T) - 1;
|
||||
}
|
||||
|
||||
OPJ_OFF_T opj_stream_default_skip(OPJ_OFF_T p_nb_bytes, void * p_user_data)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(p_nb_bytes);
|
||||
OPJ_ARG_NOT_USED(p_user_data);
|
||||
return (OPJ_OFF_T) - 1;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_stream_default_seek(OPJ_OFF_T p_nb_bytes, void * p_user_data)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(p_nb_bytes);
|
||||
OPJ_ARG_NOT_USED(p_user_data);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
Vendored
+412
@@ -0,0 +1,412 @@
|
||||
/*
|
||||
* 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, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPJ_CIO_H
|
||||
#define OPJ_CIO_H
|
||||
/**
|
||||
@file cio.h
|
||||
@brief Implementation of a byte input-output process (CIO)
|
||||
|
||||
The functions in CIO.C have for goal to realize a byte input / output process.
|
||||
*/
|
||||
|
||||
/** @defgroup CIO CIO - byte input-output stream */
|
||||
/*@{*/
|
||||
|
||||
#include "opj_config_private.h"
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
#if defined(OPJ_BIG_ENDIAN)
|
||||
#define opj_write_bytes opj_write_bytes_BE
|
||||
#define opj_read_bytes opj_read_bytes_BE
|
||||
#define opj_write_double opj_write_double_BE
|
||||
#define opj_read_double opj_read_double_BE
|
||||
#define opj_write_float opj_write_float_BE
|
||||
#define opj_read_float opj_read_float_BE
|
||||
#else
|
||||
#define opj_write_bytes opj_write_bytes_LE
|
||||
#define opj_read_bytes opj_read_bytes_LE
|
||||
#define opj_write_double opj_write_double_LE
|
||||
#define opj_read_double opj_read_double_LE
|
||||
#define opj_write_float opj_write_float_LE
|
||||
#define opj_read_float opj_read_float_LE
|
||||
#endif
|
||||
|
||||
|
||||
#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.
|
||||
*/
|
||||
typedef struct opj_stream_private {
|
||||
/**
|
||||
* User data, be it files, ... The actual data depends on the type of the stream.
|
||||
*/
|
||||
void * m_user_data;
|
||||
|
||||
/**
|
||||
* Pointer to function to free m_user_data (NULL at initialization)
|
||||
* when destroying the stream. If pointer is NULL the function is not
|
||||
* called and the m_user_data is not freed (even if non-NULL).
|
||||
*/
|
||||
opj_stream_free_user_data_fn m_free_user_data_fn;
|
||||
|
||||
/**
|
||||
* User data length
|
||||
*/
|
||||
OPJ_UINT64 m_user_data_length;
|
||||
|
||||
/**
|
||||
* Pointer to actual read function (NULL at the initialization of the cio.
|
||||
*/
|
||||
opj_stream_read_fn m_read_fn;
|
||||
|
||||
/**
|
||||
* Pointer to actual write function (NULL at the initialization of the cio.
|
||||
*/
|
||||
opj_stream_write_fn m_write_fn;
|
||||
|
||||
/**
|
||||
* Pointer to actual skip function (NULL at the initialization of the cio.
|
||||
* There is no seek function to prevent from back and forth slow procedures.
|
||||
*/
|
||||
opj_stream_skip_fn m_skip_fn;
|
||||
|
||||
/**
|
||||
* Pointer to actual seek function (if available).
|
||||
*/
|
||||
opj_stream_seek_fn m_seek_fn;
|
||||
|
||||
/**
|
||||
* Actual data stored into the stream if readed from. Data is read by chunk of fixed size.
|
||||
* you should never access this data directly.
|
||||
*/
|
||||
OPJ_BYTE * m_stored_data;
|
||||
|
||||
/**
|
||||
* Pointer to the current read data.
|
||||
*/
|
||||
OPJ_BYTE * m_current_data;
|
||||
|
||||
/**
|
||||
* FIXME DOC.
|
||||
*/
|
||||
OPJ_OFF_T(* m_opj_skip)(struct opj_stream_private *, OPJ_OFF_T,
|
||||
struct opj_event_mgr *);
|
||||
|
||||
/**
|
||||
* FIXME DOC.
|
||||
*/
|
||||
OPJ_BOOL(* m_opj_seek)(struct opj_stream_private *, OPJ_OFF_T,
|
||||
struct opj_event_mgr *);
|
||||
|
||||
/**
|
||||
* number of bytes containing in the buffer.
|
||||
*/
|
||||
OPJ_SIZE_T m_bytes_in_buffer;
|
||||
|
||||
/**
|
||||
* The number of bytes read/written from the beginning of the stream
|
||||
*/
|
||||
OPJ_OFF_T m_byte_offset;
|
||||
|
||||
/**
|
||||
* The size of the buffer.
|
||||
*/
|
||||
OPJ_SIZE_T m_buffer_size;
|
||||
|
||||
/**
|
||||
* Flags to tell the status of the stream.
|
||||
* Used with OPJ_STREAM_STATUS_* defines.
|
||||
*/
|
||||
OPJ_UINT32 m_status;
|
||||
|
||||
}
|
||||
opj_stream_private_t;
|
||||
|
||||
/** @name Exported functions (see also openjpeg.h) */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
|
||||
* @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
|
||||
*/
|
||||
void opj_write_bytes_BE(OPJ_BYTE * p_buffer, OPJ_UINT32 p_value,
|
||||
OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
|
||||
* @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 occurred.
|
||||
*/
|
||||
void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value,
|
||||
OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
/**
|
||||
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
|
||||
* @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 occurred
|
||||
*/
|
||||
void opj_write_bytes_LE(OPJ_BYTE * p_buffer, OPJ_UINT32 p_value,
|
||||
OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
|
||||
* @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 occurred.
|
||||
*/
|
||||
void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value,
|
||||
OPJ_UINT32 p_nb_bytes);
|
||||
|
||||
|
||||
/**
|
||||
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to write data to.
|
||||
* @param p_value the value to write
|
||||
*/
|
||||
void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
|
||||
|
||||
/***
|
||||
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to write data to.
|
||||
* @param p_value the value to write
|
||||
*/
|
||||
void opj_write_double_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to read data from.
|
||||
* @param p_value pointer to the value that will store the data.
|
||||
*/
|
||||
void opj_read_double_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to read data from.
|
||||
* @param p_value pointer to the value that will store the data.
|
||||
*/
|
||||
void opj_read_double_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to read data from.
|
||||
* @param p_value pointer to the value that will store the data.
|
||||
*/
|
||||
void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to read data from.
|
||||
* @param p_value pointer to the value that will store the data.
|
||||
*/
|
||||
void opj_read_float_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value);
|
||||
|
||||
/**
|
||||
* Write some bytes to the given data buffer, this function is used in Little Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to write data to.
|
||||
* @param p_value the value to write
|
||||
*/
|
||||
void opj_write_float_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
|
||||
|
||||
/***
|
||||
* Write some bytes to the given data buffer, this function is used in Big Endian cpus.
|
||||
* @param p_buffer pointer the data buffer to write data to.
|
||||
* @param p_value the value to write
|
||||
*/
|
||||
void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
|
||||
|
||||
/**
|
||||
* Reads some bytes from the stream.
|
||||
* @param p_stream the stream to read data from.
|
||||
* @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 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);
|
||||
|
||||
/**
|
||||
* Writes some bytes to the stream.
|
||||
* @param p_stream the stream to write data to.
|
||||
* @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 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);
|
||||
|
||||
/**
|
||||
* Writes the content of the stream buffer to the stream.
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_event_mgr the user event manager to be notified of special events.
|
||||
* @return true if the data could be flushed, false else.
|
||||
*/
|
||||
OPJ_BOOL opj_stream_flush(opj_stream_private_t * p_stream,
|
||||
struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
/**
|
||||
* Skips a number of bytes from the 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 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);
|
||||
|
||||
/**
|
||||
* Tells the byte offset on the stream (similar to ftell).
|
||||
*
|
||||
* @param p_stream the stream to get the information from.
|
||||
*
|
||||
* @return the current position o fthe stream.
|
||||
*/
|
||||
OPJ_OFF_T opj_stream_tell(const opj_stream_private_t * p_stream);
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of bytes left before the end of the stream (similar to cio_numbytesleft).
|
||||
*
|
||||
* @param p_stream the stream to get the information from.
|
||||
*
|
||||
* @return Number of bytes left before the end of the stream.
|
||||
*/
|
||||
OPJ_OFF_T opj_stream_get_number_byte_left(const opj_stream_private_t *
|
||||
p_stream);
|
||||
|
||||
/**
|
||||
* Skips a number of bytes from the 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 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);
|
||||
|
||||
/**
|
||||
* Skips a number of bytes from the 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 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);
|
||||
|
||||
/**
|
||||
* Skips a number of bytes from the 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 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);
|
||||
|
||||
/**
|
||||
* Skips a number of bytes from the 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 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);
|
||||
|
||||
/**
|
||||
* Seeks a number of bytes from the 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 true if the stream is seekable.
|
||||
*/
|
||||
OPJ_BOOL opj_stream_seek(opj_stream_private_t * p_stream, OPJ_OFF_T p_size,
|
||||
struct opj_event_mgr * p_event_mgr);
|
||||
|
||||
/**
|
||||
* Tells if the given stream is seekable.
|
||||
*/
|
||||
OPJ_BOOL opj_stream_has_seek(const opj_stream_private_t * p_stream);
|
||||
|
||||
/**
|
||||
* FIXME DOC.
|
||||
*/
|
||||
OPJ_SIZE_T opj_stream_default_read(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
|
||||
void * p_user_data);
|
||||
|
||||
/**
|
||||
* FIXME DOC.
|
||||
*/
|
||||
OPJ_SIZE_T opj_stream_default_write(void * p_buffer, OPJ_SIZE_T p_nb_bytes,
|
||||
void * p_user_data);
|
||||
|
||||
/**
|
||||
* FIXME DOC.
|
||||
*/
|
||||
OPJ_OFF_T opj_stream_default_skip(OPJ_OFF_T p_nb_bytes, void * p_user_data);
|
||||
|
||||
/**
|
||||
* FIXME DOC.
|
||||
*/
|
||||
OPJ_BOOL opj_stream_default_seek(OPJ_OFF_T p_nb_bytes, void * p_user_data);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
#endif /* OPJ_CIO_H */
|
||||
|
||||
Vendored
+2892
File diff suppressed because it is too large
Load Diff
Vendored
+128
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef OPJ_DWT_H
|
||||
#define OPJ_DWT_H
|
||||
/**
|
||||
@file dwt.h
|
||||
@brief Implementation of a discrete wavelet transform (DWT)
|
||||
|
||||
The functions in DWT.C have for goal to realize forward and inverse discret wavelet
|
||||
transform with filter 5-3 (reversible) and filter 9-7 (irreversible). The functions in
|
||||
DWT.C are used by some function in TCD.C.
|
||||
*/
|
||||
|
||||
/** @defgroup DWT DWT - Implementation of a discrete wavelet transform */
|
||||
/*@{*/
|
||||
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
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 transform in 2-D.
|
||||
Apply a reversible inverse DWT transform to a component of an image.
|
||||
@param p_tcd TCD handle
|
||||
@param tilec Tile component information (current tile)
|
||||
@param numres Number of resolution levels to decode
|
||||
*/
|
||||
OPJ_BOOL opj_dwt_decode(opj_tcd_t *p_tcd,
|
||||
opj_tcd_tilecomp_t* tilec,
|
||||
OPJ_UINT32 numres);
|
||||
|
||||
/**
|
||||
Get the gain of a subband for the reversible 5-3 DWT.
|
||||
@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
|
||||
@return Returns 0 if orient = 0, returns 1 if orient = 1 or 2, returns 2 otherwise
|
||||
*/
|
||||
OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) ;
|
||||
/**
|
||||
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
|
||||
@param level Level of the wavelet function
|
||||
@param orient Band of the wavelet function
|
||||
@return Returns the norm of the wavelet function
|
||||
*/
|
||||
OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
|
||||
/**
|
||||
Forward 9-7 wavelet transform in 2-D.
|
||||
Apply an irreversible DWT transform to a component of an image.
|
||||
@param tilec Tile component information (current tile)
|
||||
*/
|
||||
OPJ_BOOL opj_dwt_encode_real(opj_tcd_tilecomp_t * tilec);
|
||||
/**
|
||||
Inverse 9-7 wavelet transform in 2-D.
|
||||
Apply an irreversible inverse DWT transform to a component of an image.
|
||||
@param p_tcd TCD handle
|
||||
@param tilec Tile component information (current tile)
|
||||
@param numres Number of resolution levels to decode
|
||||
*/
|
||||
OPJ_BOOL opj_dwt_decode_real(opj_tcd_t *p_tcd,
|
||||
opj_tcd_tilecomp_t* OPJ_RESTRICT tilec,
|
||||
OPJ_UINT32 numres);
|
||||
|
||||
/**
|
||||
Get the gain of a subband for the irreversible 9-7 DWT.
|
||||
@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
|
||||
@return Returns the gain of the 9-7 wavelet transform
|
||||
*/
|
||||
OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient);
|
||||
/**
|
||||
Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT
|
||||
@param level Level of the wavelet function
|
||||
@param orient Band of the wavelet function
|
||||
@return Returns the norm of the 9-7 wavelet
|
||||
*/
|
||||
OPJ_FLOAT64 opj_dwt_getnorm_real(OPJ_UINT32 level, OPJ_UINT32 orient);
|
||||
/**
|
||||
Explicit calculation of the Quantization Stepsizes
|
||||
@param tccp Tile-component coding parameters
|
||||
@param prec Precint analyzed
|
||||
*/
|
||||
void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_DWT_H */
|
||||
Vendored
+151
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/* ==========================================================
|
||||
Utility functions
|
||||
==========================================================*/
|
||||
|
||||
#ifdef OPJ_CODE_NOT_USED
|
||||
#ifndef _WIN32
|
||||
static char*
|
||||
i2a(unsigned i, char *a, unsigned r)
|
||||
{
|
||||
if (i / r > 0) {
|
||||
a = i2a(i / r, a, r);
|
||||
}
|
||||
*a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r];
|
||||
return a + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
Transforms integer i into an ascii string and stores the result in a;
|
||||
string is encoded in the base indicated by r.
|
||||
@param i Number to be converted
|
||||
@param a String result
|
||||
@param r Base of value; must be in the range 2 - 36
|
||||
@return Returns a
|
||||
*/
|
||||
static char *
|
||||
_itoa(int i, char *a, int r)
|
||||
{
|
||||
r = ((r < 2) || (r > 36)) ? 10 : r;
|
||||
if (i < 0) {
|
||||
*a = '-';
|
||||
*i2a(-i, a + 1, r) = 0;
|
||||
} else {
|
||||
*i2a(i, a, r) = 0;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
#endif /* !_WIN32 */
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/**
|
||||
* Default callback function.
|
||||
* Do nothing.
|
||||
*/
|
||||
static void opj_default_callback(const char *msg, void *client_data)
|
||||
{
|
||||
OPJ_ARG_NOT_USED(msg);
|
||||
OPJ_ARG_NOT_USED(client_data);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, OPJ_INT32 event_type,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
#define OPJ_MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
|
||||
opj_msg_callback msg_handler = 00;
|
||||
void * l_data = 00;
|
||||
|
||||
if (p_event_mgr != 00) {
|
||||
switch (event_type) {
|
||||
case EVT_ERROR:
|
||||
msg_handler = p_event_mgr->error_handler;
|
||||
l_data = p_event_mgr->m_error_data;
|
||||
break;
|
||||
case EVT_WARNING:
|
||||
msg_handler = p_event_mgr->warning_handler;
|
||||
l_data = p_event_mgr->m_warning_data;
|
||||
break;
|
||||
case EVT_INFO:
|
||||
msg_handler = p_event_mgr->info_handler;
|
||||
l_data = p_event_mgr->m_info_data;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (msg_handler == 00) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
} else {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if ((fmt != 00) && (p_event_mgr != 00)) {
|
||||
va_list arg;
|
||||
char message[OPJ_MSG_SIZE];
|
||||
memset(message, 0, OPJ_MSG_SIZE);
|
||||
/* initialize the optional parameter list */
|
||||
va_start(arg, fmt);
|
||||
/* parse the format string and put the result in 'message' */
|
||||
vsnprintf(message, OPJ_MSG_SIZE, fmt, arg);
|
||||
/* force zero termination for Windows _vsnprintf() of old MSVC */
|
||||
message[OPJ_MSG_SIZE - 1] = '\0';
|
||||
/* deinitialize the optional parameter list */
|
||||
va_end(arg);
|
||||
|
||||
/* output the message to the user program */
|
||||
msg_handler(message, l_data);
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
void opj_set_default_event_handler(opj_event_mgr_t * p_manager)
|
||||
{
|
||||
p_manager->m_error_data = 00;
|
||||
p_manager->m_warning_data = 00;
|
||||
p_manager->m_info_data = 00;
|
||||
p_manager->error_handler = opj_default_callback;
|
||||
p_manager->info_handler = opj_default_callback;
|
||||
p_manager->warning_handler = opj_default_callback;
|
||||
}
|
||||
|
||||
Vendored
+108
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef OPJ_EVENT_H
|
||||
#define OPJ_EVENT_H
|
||||
/**
|
||||
@file event.h
|
||||
@brief Implementation of a event callback system
|
||||
|
||||
The functions in EVENT.C have for goal to send output messages (errors, warnings, debug) to the user.
|
||||
*/
|
||||
/**
|
||||
Message handler object
|
||||
used for
|
||||
<ul>
|
||||
<li>Error messages
|
||||
<li>Warning messages
|
||||
<li>Debugging messages
|
||||
</ul>
|
||||
*/
|
||||
typedef struct opj_event_mgr {
|
||||
/** Data to call the event manager upon */
|
||||
void * m_error_data;
|
||||
/** Data to call the event manager upon */
|
||||
void * m_warning_data;
|
||||
/** Data to call the event manager upon */
|
||||
void * m_info_data;
|
||||
/** Error message callback if available, NULL otherwise */
|
||||
opj_msg_callback error_handler;
|
||||
/** Warning message callback if available, NULL otherwise */
|
||||
opj_msg_callback warning_handler;
|
||||
/** Debug message callback if available, NULL otherwise */
|
||||
opj_msg_callback info_handler;
|
||||
} opj_event_mgr_t;
|
||||
|
||||
|
||||
#define EVT_ERROR 1 /**< Error event type */
|
||||
#define EVT_WARNING 2 /**< Warning event type */
|
||||
#define EVT_INFO 4 /**< Debug event type */
|
||||
|
||||
/** @defgroup EVENT EVENT - Implementation of a event callback system */
|
||||
/*@{*/
|
||||
|
||||
/** @name Exported functions (see also openjpeg.h) */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Write formatted data to a string and send the string to a user callback.
|
||||
*
|
||||
* @param event_mgr Event handler
|
||||
* @param event_type Event type or callback to use to send the message
|
||||
* @param fmt Format-control string (plus optional arguments)
|
||||
*
|
||||
* @return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
OPJ_BOOL opj_event_msg(opj_event_mgr_t* event_mgr, OPJ_INT32 event_type,
|
||||
const char *fmt, ...);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Set the event manager with the default callback function for the 3 levels.
|
||||
*/
|
||||
void opj_set_default_event_handler(opj_event_mgr_t * p_manager);
|
||||
|
||||
/*
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC poison printf fprintf
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_EVENT_H */
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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) 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.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/**
|
||||
* Default size of the validation list, if not sufficient, data will be reallocated with a double size.
|
||||
*/
|
||||
#define OPJ_VALIDATION_SIZE 10
|
||||
|
||||
opj_procedure_list_t * opj_procedure_list_create()
|
||||
{
|
||||
/* memory allocation */
|
||||
opj_procedure_list_t * l_validation = (opj_procedure_list_t *) opj_calloc(1,
|
||||
sizeof(opj_procedure_list_t));
|
||||
if (! l_validation) {
|
||||
return 00;
|
||||
}
|
||||
/* initialization */
|
||||
l_validation->m_nb_max_procedures = OPJ_VALIDATION_SIZE;
|
||||
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;
|
||||
}
|
||||
return l_validation;
|
||||
}
|
||||
|
||||
void opj_procedure_list_destroy(opj_procedure_list_t * p_list)
|
||||
{
|
||||
if (! p_list) {
|
||||
return;
|
||||
}
|
||||
/* initialization */
|
||||
if (p_list->m_procedures) {
|
||||
opj_free(p_list->m_procedures);
|
||||
}
|
||||
opj_free(p_list);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
p_validation_list->m_nb_max_procedures += OPJ_VALIDATION_SIZE;
|
||||
new_procedures = (opj_procedure*)opj_realloc(
|
||||
p_validation_list->m_procedures,
|
||||
p_validation_list->m_nb_max_procedures * sizeof(opj_procedure));
|
||||
if (! new_procedures) {
|
||||
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");
|
||||
return OPJ_FALSE;
|
||||
} else {
|
||||
p_validation_list->m_procedures = new_procedures;
|
||||
}
|
||||
}
|
||||
p_validation_list->m_procedures[p_validation_list->m_nb_procedures] =
|
||||
p_procedure;
|
||||
++p_validation_list->m_nb_procedures;
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_UINT32 opj_procedure_list_get_nb_procedures(opj_procedure_list_t *
|
||||
p_validation_list)
|
||||
{
|
||||
return p_validation_list->m_nb_procedures;
|
||||
}
|
||||
|
||||
opj_procedure* opj_procedure_list_get_first_procedure(opj_procedure_list_t *
|
||||
p_validation_list)
|
||||
{
|
||||
return p_validation_list->m_procedures;
|
||||
}
|
||||
|
||||
void opj_procedure_list_clear(opj_procedure_list_t * p_validation_list)
|
||||
{
|
||||
p_validation_list->m_nb_procedures = 0;
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* 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) 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 OPJ_FUNCTION_LIST_H
|
||||
#define OPJ_FUNCTION_LIST_H
|
||||
|
||||
/**
|
||||
* @file function_list.h
|
||||
* @brief Implementation of a list of procedures.
|
||||
|
||||
* The functions in validation.c aims to have access to a list of procedures.
|
||||
*/
|
||||
|
||||
/** @defgroup VAL VAL - validation procedure*/
|
||||
/*@{*/
|
||||
|
||||
/**************************************************************************************************
|
||||
***************************************** FORWARD DECLARATION ************************************
|
||||
**************************************************************************************************/
|
||||
|
||||
/**
|
||||
* declare a function pointer
|
||||
*/
|
||||
typedef void (*opj_procedure)(void);
|
||||
|
||||
/**
|
||||
* A list of procedures.
|
||||
*/
|
||||
typedef struct opj_procedure_list {
|
||||
/**
|
||||
* The number of validation procedures.
|
||||
*/
|
||||
OPJ_UINT32 m_nb_procedures;
|
||||
/**
|
||||
* The number of the array of validation procedures.
|
||||
*/
|
||||
OPJ_UINT32 m_nb_max_procedures;
|
||||
/**
|
||||
* The array of procedures.
|
||||
*/
|
||||
opj_procedure * m_procedures;
|
||||
|
||||
} opj_procedure_list_t;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Creates a validation list.
|
||||
*
|
||||
* @return the newly created validation list.
|
||||
*/
|
||||
opj_procedure_list_t * opj_procedure_list_create(void);
|
||||
|
||||
/**
|
||||
* Destroys a validation list.
|
||||
*
|
||||
* @param p_list the list to destroy.
|
||||
*/
|
||||
void opj_procedure_list_destroy(opj_procedure_list_t * p_list);
|
||||
|
||||
/**
|
||||
* Adds a new validation procedure.
|
||||
*
|
||||
* @param p_validation_list the list of procedure to modify.
|
||||
* @param p_procedure the procedure to add.
|
||||
* @param p_manager the user event manager.
|
||||
*
|
||||
* @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_event_mgr_t* p_manager);
|
||||
|
||||
/**
|
||||
* Gets the number of validation procedures.
|
||||
*
|
||||
* @param p_validation_list the list of procedure to modify.
|
||||
*
|
||||
* @return the number of validation procedures.
|
||||
*/
|
||||
OPJ_UINT32 opj_procedure_list_get_nb_procedures(opj_procedure_list_t *
|
||||
p_validation_list);
|
||||
|
||||
/**
|
||||
* Gets the pointer on the first validation procedure. This function is similar to the C++
|
||||
* iterator class to iterate through all the procedures inside the validation list.
|
||||
* the caller does not take ownership of the pointer.
|
||||
*
|
||||
* @param p_validation_list the list of procedure to get the first procedure from.
|
||||
*
|
||||
* @return a pointer to the first procedure.
|
||||
*/
|
||||
opj_procedure* opj_procedure_list_get_first_procedure(opj_procedure_list_t *
|
||||
p_validation_list);
|
||||
|
||||
|
||||
/**
|
||||
* Clears the list of validation procedures.
|
||||
*
|
||||
* @param p_validation_list the list of procedure to clear.
|
||||
*
|
||||
*/
|
||||
void opj_procedure_list_clear(opj_procedure_list_t * p_validation_list);
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_FUNCTION_LIST_H */
|
||||
|
||||
Vendored
+264
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
opj_image_t* opj_image_create0(void)
|
||||
{
|
||||
opj_image_t *image = (opj_image_t*)opj_calloc(1, sizeof(opj_image_t));
|
||||
return image;
|
||||
}
|
||||
|
||||
opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts,
|
||||
opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc)
|
||||
{
|
||||
OPJ_UINT32 compno;
|
||||
opj_image_t *image = NULL;
|
||||
|
||||
image = (opj_image_t*) opj_calloc(1, sizeof(opj_image_t));
|
||||
if (image) {
|
||||
image->color_space = clrspc;
|
||||
image->numcomps = numcmpts;
|
||||
/* allocate memory for the per-component information */
|
||||
image->comps = (opj_image_comp_t*)opj_calloc(image->numcomps,
|
||||
sizeof(opj_image_comp_t));
|
||||
if (!image->comps) {
|
||||
/* TODO replace with event manager, breaks API */
|
||||
/* fprintf(stderr,"Unable to allocate memory for image.\n"); */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
/* create the individual image components */
|
||||
for (compno = 0; compno < numcmpts; compno++) {
|
||||
opj_image_comp_t *comp = &image->comps[compno];
|
||||
comp->dx = cmptparms[compno].dx;
|
||||
comp->dy = cmptparms[compno].dy;
|
||||
comp->w = cmptparms[compno].w;
|
||||
comp->h = cmptparms[compno].h;
|
||||
comp->x0 = cmptparms[compno].x0;
|
||||
comp->y0 = cmptparms[compno].y0;
|
||||
comp->prec = cmptparms[compno].prec;
|
||||
comp->bpp = cmptparms[compno].bpp;
|
||||
comp->sgnd = cmptparms[compno].sgnd;
|
||||
if (comp->h != 0 &&
|
||||
(OPJ_SIZE_T)comp->w > SIZE_MAX / comp->h / sizeof(OPJ_INT32)) {
|
||||
/* TODO event manager */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
comp->data = (OPJ_INT32*) opj_image_data_alloc(
|
||||
(size_t)comp->w * comp->h * sizeof(OPJ_INT32));
|
||||
if (!comp->data) {
|
||||
/* TODO replace with event manager, breaks API */
|
||||
/* fprintf(stderr,"Unable to allocate memory for image.\n"); */
|
||||
opj_image_destroy(image);
|
||||
return NULL;
|
||||
}
|
||||
memset(comp->data, 0, (size_t)comp->w * comp->h * sizeof(OPJ_INT32));
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_image_destroy(opj_image_t *image)
|
||||
{
|
||||
if (image) {
|
||||
if (image->comps) {
|
||||
OPJ_UINT32 compno;
|
||||
|
||||
/* image components */
|
||||
for (compno = 0; compno < image->numcomps; compno++) {
|
||||
opj_image_comp_t *image_comp = &(image->comps[compno]);
|
||||
if (image_comp->data) {
|
||||
opj_image_data_free(image_comp->data);
|
||||
}
|
||||
}
|
||||
opj_free(image->comps);
|
||||
}
|
||||
|
||||
if (image->icc_profile_buf) {
|
||||
opj_free(image->icc_profile_buf);
|
||||
}
|
||||
|
||||
opj_free(image);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the components characteristics of the image from the coding parameters.
|
||||
*
|
||||
* @param p_image_header the image header to update.
|
||||
* @param p_cp the coding parameters from which to update the 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_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_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_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 = l_comp_x0;
|
||||
l_img_comp->y0 = l_comp_y0;
|
||||
++l_img_comp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy only header of image and its component header (no data are copied)
|
||||
* if dest image have data, they will be freed
|
||||
*
|
||||
* @param p_image_src the src image
|
||||
* @param p_image_dest the dest image
|
||||
*
|
||||
*/
|
||||
void opj_copy_image_header(const opj_image_t* p_image_src,
|
||||
opj_image_t* p_image_dest)
|
||||
{
|
||||
OPJ_UINT32 compno;
|
||||
|
||||
/* preconditions */
|
||||
assert(p_image_src != 00);
|
||||
assert(p_image_dest != 00);
|
||||
|
||||
p_image_dest->x0 = p_image_src->x0;
|
||||
p_image_dest->y0 = p_image_src->y0;
|
||||
p_image_dest->x1 = p_image_src->x1;
|
||||
p_image_dest->y1 = p_image_src->y1;
|
||||
|
||||
if (p_image_dest->comps) {
|
||||
for (compno = 0; compno < p_image_dest->numcomps; compno++) {
|
||||
opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]);
|
||||
if (image_comp->data) {
|
||||
opj_image_data_free(image_comp->data);
|
||||
}
|
||||
}
|
||||
opj_free(p_image_dest->comps);
|
||||
p_image_dest->comps = NULL;
|
||||
}
|
||||
|
||||
p_image_dest->numcomps = p_image_src->numcomps;
|
||||
|
||||
p_image_dest->comps = (opj_image_comp_t*) opj_malloc(p_image_dest->numcomps *
|
||||
sizeof(opj_image_comp_t));
|
||||
if (!p_image_dest->comps) {
|
||||
p_image_dest->comps = NULL;
|
||||
p_image_dest->numcomps = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
for (compno = 0; compno < p_image_dest->numcomps; compno++) {
|
||||
memcpy(&(p_image_dest->comps[compno]),
|
||||
&(p_image_src->comps[compno]),
|
||||
sizeof(opj_image_comp_t));
|
||||
p_image_dest->comps[compno].data = NULL;
|
||||
}
|
||||
|
||||
p_image_dest->color_space = p_image_src->color_space;
|
||||
p_image_dest->icc_profile_len = p_image_src->icc_profile_len;
|
||||
|
||||
if (p_image_dest->icc_profile_len) {
|
||||
p_image_dest->icc_profile_buf = (OPJ_BYTE*)opj_malloc(
|
||||
p_image_dest->icc_profile_len);
|
||||
if (!p_image_dest->icc_profile_buf) {
|
||||
p_image_dest->icc_profile_buf = NULL;
|
||||
p_image_dest->icc_profile_len = 0;
|
||||
return;
|
||||
}
|
||||
memcpy(p_image_dest->icc_profile_buf,
|
||||
p_image_src->icc_profile_buf,
|
||||
p_image_src->icc_profile_len);
|
||||
} else {
|
||||
p_image_dest->icc_profile_buf = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts,
|
||||
opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc)
|
||||
{
|
||||
OPJ_UINT32 compno;
|
||||
opj_image_t *image = 00;
|
||||
|
||||
image = (opj_image_t*) opj_calloc(1, sizeof(opj_image_t));
|
||||
if (image) {
|
||||
|
||||
image->color_space = clrspc;
|
||||
image->numcomps = numcmpts;
|
||||
|
||||
/* allocate memory for the per-component information */
|
||||
image->comps = (opj_image_comp_t*)opj_calloc(image->numcomps,
|
||||
sizeof(opj_image_comp_t));
|
||||
if (!image->comps) {
|
||||
opj_image_destroy(image);
|
||||
return 00;
|
||||
}
|
||||
|
||||
/* create the individual image components */
|
||||
for (compno = 0; compno < numcmpts; compno++) {
|
||||
opj_image_comp_t *comp = &image->comps[compno];
|
||||
comp->dx = cmptparms[compno].dx;
|
||||
comp->dy = cmptparms[compno].dy;
|
||||
comp->w = cmptparms[compno].w;
|
||||
comp->h = cmptparms[compno].h;
|
||||
comp->x0 = cmptparms[compno].x0;
|
||||
comp->y0 = cmptparms[compno].y0;
|
||||
comp->prec = cmptparms[compno].prec;
|
||||
comp->sgnd = cmptparms[compno].sgnd;
|
||||
comp->data = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef OPJ_IMAGE_H
|
||||
#define OPJ_IMAGE_H
|
||||
/**
|
||||
@file image.h
|
||||
@brief Implementation of operations on images (IMAGE)
|
||||
|
||||
The functions in IMAGE.C have for goal to realize operations on images.
|
||||
*/
|
||||
|
||||
struct opj_image;
|
||||
struct opj_cp;
|
||||
|
||||
/** @defgroup IMAGE IMAGE - Implementation of operations on images */
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Create an empty image
|
||||
*
|
||||
* @return returns an empty image if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_image_t* opj_image_create0(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Updates the components characteristics of the image from the coding parameters.
|
||||
*
|
||||
* @param p_image_header the image header to update.
|
||||
* @param p_cp the coding parameters from which to update the image.
|
||||
*/
|
||||
void opj_image_comp_header_update(opj_image_t * p_image,
|
||||
const struct opj_cp* p_cp);
|
||||
|
||||
void opj_copy_image_header(const opj_image_t* p_image_src,
|
||||
opj_image_t* p_image_dest);
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_IMAGE_H */
|
||||
|
||||
Vendored
+295
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* 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) 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.
|
||||
*/
|
||||
|
||||
#include "opj_includes.h"
|
||||
|
||||
/**
|
||||
* LUP decomposition
|
||||
*/
|
||||
static OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,
|
||||
OPJ_UINT32 * permutations,
|
||||
OPJ_FLOAT32 * p_swap_area,
|
||||
OPJ_UINT32 nb_compo);
|
||||
/**
|
||||
* LUP solving
|
||||
*/
|
||||
static void opj_lupSolve(OPJ_FLOAT32 * pResult,
|
||||
OPJ_FLOAT32* pMatrix,
|
||||
OPJ_FLOAT32* pVector,
|
||||
OPJ_UINT32* pPermutations,
|
||||
OPJ_UINT32 nb_compo,
|
||||
OPJ_FLOAT32 * p_intermediate_data);
|
||||
|
||||
/**
|
||||
*LUP inversion (call with the result of lupDecompose)
|
||||
*/
|
||||
static void opj_lupInvert(OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_FLOAT32 * pDestMatrix,
|
||||
OPJ_UINT32 nb_compo,
|
||||
OPJ_UINT32 * pPermutations,
|
||||
OPJ_FLOAT32 * p_src_temp,
|
||||
OPJ_FLOAT32 * p_dest_temp,
|
||||
OPJ_FLOAT32 * p_swap_area);
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Matric inversion interface
|
||||
==========================================================
|
||||
*/
|
||||
/**
|
||||
* Matrix inversion.
|
||||
*/
|
||||
OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_FLOAT32 * pDestMatrix,
|
||||
OPJ_UINT32 nb_compo)
|
||||
{
|
||||
OPJ_BYTE * l_data = 00;
|
||||
OPJ_UINT32 l_permutation_size = nb_compo * (OPJ_UINT32)sizeof(OPJ_UINT32);
|
||||
OPJ_UINT32 l_swap_size = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
|
||||
OPJ_UINT32 l_total_size = l_permutation_size + 3 * l_swap_size;
|
||||
OPJ_UINT32 * lPermutations = 00;
|
||||
OPJ_FLOAT32 * l_double_data = 00;
|
||||
|
||||
l_data = (OPJ_BYTE *) opj_malloc(l_total_size);
|
||||
if (l_data == 0) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
lPermutations = (OPJ_UINT32 *) l_data;
|
||||
l_double_data = (OPJ_FLOAT32 *)(l_data + l_permutation_size);
|
||||
memset(lPermutations, 0, l_permutation_size);
|
||||
|
||||
if (! opj_lupDecompose(pSrcMatrix, lPermutations, l_double_data, nb_compo)) {
|
||||
opj_free(l_data);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
opj_lupInvert(pSrcMatrix, pDestMatrix, nb_compo, lPermutations, l_double_data,
|
||||
l_double_data + nb_compo, l_double_data + 2 * nb_compo);
|
||||
opj_free(l_data);
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
Local functions
|
||||
==========================================================
|
||||
*/
|
||||
static OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,
|
||||
OPJ_UINT32 * permutations,
|
||||
OPJ_FLOAT32 * p_swap_area,
|
||||
OPJ_UINT32 nb_compo)
|
||||
{
|
||||
OPJ_UINT32 * tmpPermutations = permutations;
|
||||
OPJ_UINT32 * dstPermutations;
|
||||
OPJ_UINT32 k2 = 0, t;
|
||||
OPJ_FLOAT32 temp;
|
||||
OPJ_UINT32 i, j, k;
|
||||
OPJ_FLOAT32 p;
|
||||
OPJ_UINT32 lLastColum = nb_compo - 1;
|
||||
OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
|
||||
OPJ_FLOAT32 * lTmpMatrix = matrix;
|
||||
OPJ_FLOAT32 * lColumnMatrix, * lDestMatrix;
|
||||
OPJ_UINT32 offset = 1;
|
||||
OPJ_UINT32 lStride = nb_compo - 1;
|
||||
|
||||
/*initialize permutations */
|
||||
for (i = 0; i < nb_compo; ++i) {
|
||||
*tmpPermutations++ = i;
|
||||
}
|
||||
/* now make a pivot with column switch */
|
||||
tmpPermutations = permutations;
|
||||
for (k = 0; k < lLastColum; ++k) {
|
||||
p = 0.0;
|
||||
|
||||
/* take the middle element */
|
||||
lColumnMatrix = lTmpMatrix + k;
|
||||
|
||||
/* make permutation with the biggest value in the column */
|
||||
for (i = k; i < nb_compo; ++i) {
|
||||
temp = ((*lColumnMatrix > 0) ? *lColumnMatrix : -(*lColumnMatrix));
|
||||
if (temp > p) {
|
||||
p = temp;
|
||||
k2 = i;
|
||||
}
|
||||
/* next line */
|
||||
lColumnMatrix += nb_compo;
|
||||
}
|
||||
|
||||
/* a whole rest of 0 -> non singular */
|
||||
if (p == 0.0) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* should we permute ? */
|
||||
if (k2 != k) {
|
||||
/*exchange of line */
|
||||
/* k2 > k */
|
||||
dstPermutations = tmpPermutations + k2 - k;
|
||||
/* swap indices */
|
||||
t = *tmpPermutations;
|
||||
*tmpPermutations = *dstPermutations;
|
||||
*dstPermutations = t;
|
||||
|
||||
/* and swap entire line. */
|
||||
lColumnMatrix = lTmpMatrix + (k2 - k) * nb_compo;
|
||||
memcpy(p_swap_area, lColumnMatrix, lSwapSize);
|
||||
memcpy(lColumnMatrix, lTmpMatrix, lSwapSize);
|
||||
memcpy(lTmpMatrix, p_swap_area, lSwapSize);
|
||||
}
|
||||
|
||||
/* now update data in the rest of the line and line after */
|
||||
lDestMatrix = lTmpMatrix + k;
|
||||
lColumnMatrix = lDestMatrix + nb_compo;
|
||||
/* take the middle element */
|
||||
temp = *(lDestMatrix++);
|
||||
|
||||
/* now compute up data (i.e. coeff up of the diagonal). */
|
||||
for (i = offset; i < nb_compo; ++i) {
|
||||
/*lColumnMatrix; */
|
||||
/* divide the lower column elements by the diagonal value */
|
||||
|
||||
/* matrix[i][k] /= matrix[k][k]; */
|
||||
/* p = matrix[i][k] */
|
||||
p = *lColumnMatrix / temp;
|
||||
*(lColumnMatrix++) = p;
|
||||
|
||||
for (j = /* k + 1 */ offset; j < nb_compo; ++j) {
|
||||
/* matrix[i][j] -= matrix[i][k] * matrix[k][j]; */
|
||||
*(lColumnMatrix++) -= p * (*(lDestMatrix++));
|
||||
}
|
||||
/* come back to the k+1th element */
|
||||
lDestMatrix -= lStride;
|
||||
/* go to kth element of the next line */
|
||||
lColumnMatrix += k;
|
||||
}
|
||||
|
||||
/* offset is now k+2 */
|
||||
++offset;
|
||||
/* 1 element less for stride */
|
||||
--lStride;
|
||||
/* next line */
|
||||
lTmpMatrix += nb_compo;
|
||||
/* next permutation element */
|
||||
++tmpPermutations;
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
static void opj_lupSolve(OPJ_FLOAT32 * pResult,
|
||||
OPJ_FLOAT32 * pMatrix,
|
||||
OPJ_FLOAT32 * pVector,
|
||||
OPJ_UINT32* pPermutations,
|
||||
OPJ_UINT32 nb_compo, OPJ_FLOAT32 * p_intermediate_data)
|
||||
{
|
||||
OPJ_INT32 k;
|
||||
OPJ_UINT32 i, j;
|
||||
OPJ_FLOAT32 sum;
|
||||
OPJ_FLOAT32 u;
|
||||
OPJ_UINT32 lStride = nb_compo + 1;
|
||||
OPJ_FLOAT32 * lCurrentPtr;
|
||||
OPJ_FLOAT32 * lIntermediatePtr;
|
||||
OPJ_FLOAT32 * lDestPtr;
|
||||
OPJ_FLOAT32 * lTmpMatrix;
|
||||
OPJ_FLOAT32 * lLineMatrix = pMatrix;
|
||||
OPJ_FLOAT32 * lBeginPtr = pResult + nb_compo - 1;
|
||||
OPJ_FLOAT32 * lGeneratedData;
|
||||
OPJ_UINT32 * lCurrentPermutationPtr = pPermutations;
|
||||
|
||||
|
||||
lIntermediatePtr = p_intermediate_data;
|
||||
lGeneratedData = p_intermediate_data + nb_compo - 1;
|
||||
|
||||
for (i = 0; i < nb_compo; ++i) {
|
||||
sum = 0.0;
|
||||
lCurrentPtr = p_intermediate_data;
|
||||
lTmpMatrix = lLineMatrix;
|
||||
for (j = 1; j <= i; ++j) {
|
||||
/* sum += matrix[i][j-1] * y[j-1]; */
|
||||
sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++));
|
||||
}
|
||||
/*y[i] = pVector[pPermutations[i]] - sum; */
|
||||
*(lIntermediatePtr++) = pVector[*(lCurrentPermutationPtr++)] - sum;
|
||||
lLineMatrix += nb_compo;
|
||||
}
|
||||
|
||||
/* we take the last point of the matrix */
|
||||
lLineMatrix = pMatrix + nb_compo * nb_compo - 1;
|
||||
|
||||
/* and we take after the last point of the destination vector */
|
||||
lDestPtr = pResult + nb_compo;
|
||||
|
||||
|
||||
assert(nb_compo != 0);
|
||||
for (k = (OPJ_INT32)nb_compo - 1; k != -1 ; --k) {
|
||||
sum = 0.0;
|
||||
lTmpMatrix = lLineMatrix;
|
||||
u = *(lTmpMatrix++);
|
||||
lCurrentPtr = lDestPtr--;
|
||||
for (j = (OPJ_UINT32)(k + 1); j < nb_compo; ++j) {
|
||||
/* sum += matrix[k][j] * x[j] */
|
||||
sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++));
|
||||
}
|
||||
/*x[k] = (y[k] - sum) / u; */
|
||||
*(lBeginPtr--) = (*(lGeneratedData--) - sum) / u;
|
||||
lLineMatrix -= lStride;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void opj_lupInvert(OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_FLOAT32 * pDestMatrix,
|
||||
OPJ_UINT32 nb_compo,
|
||||
OPJ_UINT32 * pPermutations,
|
||||
OPJ_FLOAT32 * p_src_temp,
|
||||
OPJ_FLOAT32 * p_dest_temp,
|
||||
OPJ_FLOAT32 * p_swap_area)
|
||||
{
|
||||
OPJ_UINT32 j, i;
|
||||
OPJ_FLOAT32 * lCurrentPtr;
|
||||
OPJ_FLOAT32 * lLineMatrix = pDestMatrix;
|
||||
OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
|
||||
|
||||
for (j = 0; j < nb_compo; ++j) {
|
||||
lCurrentPtr = lLineMatrix++;
|
||||
memset(p_src_temp, 0, lSwapSize);
|
||||
p_src_temp[j] = 1.0;
|
||||
opj_lupSolve(p_dest_temp, pSrcMatrix, p_src_temp, pPermutations, nb_compo,
|
||||
p_swap_area);
|
||||
|
||||
for (i = 0; i < nb_compo; ++i) {
|
||||
*(lCurrentPtr) = p_dest_temp[i];
|
||||
lCurrentPtr += nb_compo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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) 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 OPJ_INVERT_H
|
||||
#define OPJ_INVERT_H
|
||||
/**
|
||||
@file invert.h
|
||||
@brief Implementation of the matrix inversion
|
||||
|
||||
The function in INVERT.H compute a matrix inversion with a LUP method
|
||||
*/
|
||||
|
||||
/** @defgroup INVERT INVERT - Implementation of a matrix inversion */
|
||||
/*@{*/
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Calculates a n x n double matrix inversion with a LUP method. Data is aligned, rows after rows (or columns after columns).
|
||||
* The function does not take ownership of any memory block, data must be fred by the user.
|
||||
*
|
||||
* @param pSrcMatrix the matrix to invert.
|
||||
* @param pDestMatrix data to store the inverted matrix.
|
||||
* @param nb_compo size of the matrix
|
||||
* @return OPJ_TRUE if the inversion is successful, OPJ_FALSE if the matrix is singular.
|
||||
*/
|
||||
OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_FLOAT32 * pDestMatrix,
|
||||
OPJ_UINT32 nb_compo);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_INVERT_H */
|
||||
Vendored
+12135
File diff suppressed because it is too large
Load Diff
Vendored
+880
@@ -0,0 +1,880 @@
|
||||
/*
|
||||
* 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) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef OPJ_J2K_H
|
||||
#define OPJ_J2K_H
|
||||
/**
|
||||
@file j2k.h
|
||||
@brief The JPEG-2000 Codestream Reader/Writer (J2K)
|
||||
|
||||
The functions in J2K.C have for goal to read/write the several parts of the codestream: markers and data.
|
||||
*/
|
||||
|
||||
/** @defgroup J2K J2K - JPEG-2000 codestream reader/writer */
|
||||
/*@{*/
|
||||
|
||||
#define J2K_CP_CSTY_PRT 0x01
|
||||
#define J2K_CP_CSTY_SOP 0x02
|
||||
#define J2K_CP_CSTY_EPH 0x04
|
||||
#define J2K_CCP_CSTY_PRT 0x01
|
||||
#define J2K_CCP_CBLKSTY_LAZY 0x01 /**< Selective arithmetic coding bypass */
|
||||
#define J2K_CCP_CBLKSTY_RESET 0x02 /**< Reset context probabilities on coding pass boundaries */
|
||||
#define J2K_CCP_CBLKSTY_TERMALL 0x04 /**< Termination on each coding pass */
|
||||
#define J2K_CCP_CBLKSTY_VSC 0x08 /**< Vertically stripe causal context */
|
||||
#define J2K_CCP_CBLKSTY_PTERM 0x10 /**< Predictable termination */
|
||||
#define J2K_CCP_CBLKSTY_SEGSYM 0x20 /**< Segmentation symbols are used */
|
||||
#define J2K_CCP_QNTSTY_NOQNT 0
|
||||
#define J2K_CCP_QNTSTY_SIQNT 1
|
||||
#define J2K_CCP_QNTSTY_SEQNT 2
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
#define J2K_MS_SOC 0xff4f /**< SOC marker value */
|
||||
#define J2K_MS_SOT 0xff90 /**< SOT marker value */
|
||||
#define J2K_MS_SOD 0xff93 /**< SOD marker value */
|
||||
#define J2K_MS_EOC 0xffd9 /**< EOC marker value */
|
||||
#define J2K_MS_SIZ 0xff51 /**< SIZ marker value */
|
||||
#define J2K_MS_COD 0xff52 /**< COD marker value */
|
||||
#define J2K_MS_COC 0xff53 /**< COC marker value */
|
||||
#define J2K_MS_RGN 0xff5e /**< RGN marker value */
|
||||
#define J2K_MS_QCD 0xff5c /**< QCD marker value */
|
||||
#define J2K_MS_QCC 0xff5d /**< QCC marker value */
|
||||
#define J2K_MS_POC 0xff5f /**< POC marker value */
|
||||
#define J2K_MS_TLM 0xff55 /**< TLM marker value */
|
||||
#define J2K_MS_PLM 0xff57 /**< PLM marker value */
|
||||
#define J2K_MS_PLT 0xff58 /**< PLT marker value */
|
||||
#define J2K_MS_PPM 0xff60 /**< PPM marker value */
|
||||
#define J2K_MS_PPT 0xff61 /**< PPT marker value */
|
||||
#define J2K_MS_SOP 0xff91 /**< SOP marker value */
|
||||
#define J2K_MS_EPH 0xff92 /**< EPH marker value */
|
||||
#define J2K_MS_CRG 0xff63 /**< CRG marker value */
|
||||
#define J2K_MS_COM 0xff64 /**< COM marker value */
|
||||
#define J2K_MS_CBD 0xff78 /**< CBD marker value */
|
||||
#define J2K_MS_MCC 0xff75 /**< MCC marker value */
|
||||
#define J2K_MS_MCT 0xff74 /**< MCT marker value */
|
||||
#define J2K_MS_MCO 0xff77 /**< MCO marker value */
|
||||
|
||||
#define J2K_MS_UNK 0 /**< UNKNOWN marker value */
|
||||
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
#define J2K_MS_EPC 0xff68 /**< EPC marker value (Part 11: JPEG 2000 for Wireless) */
|
||||
#define J2K_MS_EPB 0xff66 /**< EPB marker value (Part 11: JPEG 2000 for Wireless) */
|
||||
#define J2K_MS_ESD 0xff67 /**< ESD marker value (Part 11: JPEG 2000 for Wireless) */
|
||||
#define J2K_MS_RED 0xff69 /**< RED marker value (Part 11: JPEG 2000 for Wireless) */
|
||||
#endif /* USE_JPWL */
|
||||
#ifdef USE_JPSEC
|
||||
#define J2K_MS_SEC 0xff65 /**< SEC marker value (Part 8: Secure JPEG 2000) */
|
||||
#define J2K_MS_INSEC 0xff94 /**< INSEC marker value (Part 8: Secure JPEG 2000) */
|
||||
#endif /* USE_JPSEC */
|
||||
/* <<UniPG */
|
||||
|
||||
#define J2K_MAX_POCS 32 /**< Maximum number of POCs */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Values that specify the status of the decoding process when decoding the main header.
|
||||
* These values may be combined with a | operator.
|
||||
* */
|
||||
typedef enum J2K_STATUS {
|
||||
J2K_STATE_NONE = 0x0000, /**< a SOC marker is expected */
|
||||
J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */
|
||||
J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */
|
||||
J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */
|
||||
J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */
|
||||
J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */
|
||||
J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */
|
||||
J2K_STATE_NEOC = 0x0040, /**< the decoding process must not expect a EOC marker because the codestream is truncated */
|
||||
J2K_STATE_DATA = 0x0080, /**< a tile header has been successfully read and codestream is expected */
|
||||
|
||||
J2K_STATE_EOC = 0x0100, /**< the decoding process has encountered the EOC marker */
|
||||
J2K_STATE_ERR = 0x8000 /**< the decoding process has encountered an error (FIXME warning V1 = 0x0080)*/
|
||||
} J2K_STATUS;
|
||||
|
||||
/**
|
||||
* Type of elements storing in the MCT data
|
||||
*/
|
||||
typedef enum MCT_ELEMENT_TYPE {
|
||||
MCT_TYPE_INT16 = 0, /** MCT data is stored as signed shorts*/
|
||||
MCT_TYPE_INT32 = 1, /** MCT data is stored as signed integers*/
|
||||
MCT_TYPE_FLOAT = 2, /** MCT data is stored as floats*/
|
||||
MCT_TYPE_DOUBLE = 3 /** MCT data is stored as doubles*/
|
||||
} J2K_MCT_ELEMENT_TYPE;
|
||||
|
||||
/**
|
||||
* Type of MCT array
|
||||
*/
|
||||
typedef enum MCT_ARRAY_TYPE {
|
||||
MCT_TYPE_DEPENDENCY = 0,
|
||||
MCT_TYPE_DECORRELATION = 1,
|
||||
MCT_TYPE_OFFSET = 2
|
||||
} J2K_MCT_ARRAY_TYPE;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
T2 encoding mode
|
||||
*/
|
||||
typedef enum T2_MODE {
|
||||
THRESH_CALC = 0, /** Function called in Rate allocation process*/
|
||||
FINAL_PASS = 1 /** Function called in Tier 2 process*/
|
||||
} J2K_T2_MODE;
|
||||
|
||||
/**
|
||||
* Quantization stepsize
|
||||
*/
|
||||
typedef struct opj_stepsize {
|
||||
/** exponent */
|
||||
OPJ_INT32 expn;
|
||||
/** mantissa */
|
||||
OPJ_INT32 mant;
|
||||
} opj_stepsize_t;
|
||||
|
||||
/**
|
||||
Tile-component coding parameters
|
||||
*/
|
||||
typedef struct opj_tccp {
|
||||
/** coding style */
|
||||
OPJ_UINT32 csty;
|
||||
/** number of resolutions */
|
||||
OPJ_UINT32 numresolutions;
|
||||
/** code-blocks width */
|
||||
OPJ_UINT32 cblkw;
|
||||
/** code-blocks height */
|
||||
OPJ_UINT32 cblkh;
|
||||
/** code-block coding style */
|
||||
OPJ_UINT32 cblksty;
|
||||
/** discrete wavelet transform identifier */
|
||||
OPJ_UINT32 qmfbid;
|
||||
/** quantisation style */
|
||||
OPJ_UINT32 qntsty;
|
||||
/** stepsizes used for quantization */
|
||||
opj_stepsize_t stepsizes[OPJ_J2K_MAXBANDS];
|
||||
/** number of guard bits */
|
||||
OPJ_UINT32 numgbits;
|
||||
/** Region Of Interest shift */
|
||||
OPJ_INT32 roishift;
|
||||
/** precinct width */
|
||||
OPJ_UINT32 prcw[OPJ_J2K_MAXRLVLS];
|
||||
/** precinct height */
|
||||
OPJ_UINT32 prch[OPJ_J2K_MAXRLVLS];
|
||||
/** the dc_level_shift **/
|
||||
OPJ_INT32 m_dc_level_shift;
|
||||
}
|
||||
opj_tccp_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* FIXME DOC
|
||||
*/
|
||||
typedef struct opj_mct_data {
|
||||
J2K_MCT_ELEMENT_TYPE m_element_type;
|
||||
J2K_MCT_ARRAY_TYPE m_array_type;
|
||||
OPJ_UINT32 m_index;
|
||||
OPJ_BYTE * m_data;
|
||||
OPJ_UINT32 m_data_size;
|
||||
}
|
||||
opj_mct_data_t;
|
||||
|
||||
/**
|
||||
* FIXME DOC
|
||||
*/
|
||||
typedef struct opj_simple_mcc_decorrelation_data {
|
||||
OPJ_UINT32 m_index;
|
||||
OPJ_UINT32 m_nb_comps;
|
||||
opj_mct_data_t * m_decorrelation_array;
|
||||
opj_mct_data_t * m_offset_array;
|
||||
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
|
||||
tiles (information like COD, COC in main header)
|
||||
*/
|
||||
typedef struct opj_tcp {
|
||||
/** coding style */
|
||||
OPJ_UINT32 csty;
|
||||
/** progression order */
|
||||
OPJ_PROG_ORDER prg;
|
||||
/** number of layers */
|
||||
OPJ_UINT32 numlayers;
|
||||
OPJ_UINT32 num_layers_to_decode;
|
||||
/** multi-component transform identifier */
|
||||
OPJ_UINT32 mct;
|
||||
/** rates of layers */
|
||||
OPJ_FLOAT32 rates[100];
|
||||
/** number of progression order changes */
|
||||
OPJ_UINT32 numpocs;
|
||||
/** progression order changes */
|
||||
opj_poc_t pocs[J2K_MAX_POCS];
|
||||
|
||||
/** 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;
|
||||
/** Number of bytes stored inside ppt_data*/
|
||||
OPJ_UINT32 ppt_data_size;
|
||||
/** size of ppt_data*/
|
||||
OPJ_UINT32 ppt_len;
|
||||
/** add fixed_quality */
|
||||
OPJ_FLOAT32 distoratio[100];
|
||||
/** tile-component coding parameters */
|
||||
opj_tccp_t *tccps;
|
||||
/** current tile part number or -1 if first time into this tile */
|
||||
OPJ_INT32 m_current_tile_part_number;
|
||||
/** number of tile parts for the tile. */
|
||||
OPJ_UINT32 m_nb_tile_parts;
|
||||
/** data for the tile */
|
||||
OPJ_BYTE * m_data;
|
||||
/** size of data */
|
||||
OPJ_UINT32 m_data_size;
|
||||
/** encoding norms */
|
||||
OPJ_FLOAT64 * mct_norms;
|
||||
/** the mct decoding matrix */
|
||||
OPJ_FLOAT32 * m_mct_decoding_matrix;
|
||||
/** the mct coding matrix */
|
||||
OPJ_FLOAT32 * m_mct_coding_matrix;
|
||||
/** mct records */
|
||||
opj_mct_data_t * m_mct_records;
|
||||
/** the number of mct records. */
|
||||
OPJ_UINT32 m_nb_mct_records;
|
||||
/** the max number of mct records. */
|
||||
OPJ_UINT32 m_nb_max_mct_records;
|
||||
/** mcc records */
|
||||
opj_simple_mcc_decorrelation_data_t * m_mcc_records;
|
||||
/** the number of mct records. */
|
||||
OPJ_UINT32 m_nb_mcc_records;
|
||||
/** the max number of mct records. */
|
||||
OPJ_UINT32 m_nb_max_mcc_records;
|
||||
|
||||
|
||||
/***** 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_BITFIELD ppt : 1;
|
||||
/** indicates if a POC marker has been used O:NO, 1:YES */
|
||||
OPJ_BITFIELD POC : 1;
|
||||
} opj_tcp_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct opj_encoding_param {
|
||||
/** Maximum rate for each component. If == 0, component size limitation is not considered */
|
||||
OPJ_UINT32 m_max_comp_size;
|
||||
/** Position of tile part flag in progression order*/
|
||||
OPJ_INT32 m_tp_pos;
|
||||
/** fixed layer */
|
||||
OPJ_INT32 *m_matrice;
|
||||
/** Flag determining tile part generation*/
|
||||
OPJ_BYTE m_tp_flag;
|
||||
/** allocation by rate/distortion */
|
||||
OPJ_BITFIELD m_disto_alloc : 1;
|
||||
/** allocation by fixed layer */
|
||||
OPJ_BITFIELD m_fixed_alloc : 1;
|
||||
/** add fixed_quality */
|
||||
OPJ_BITFIELD m_fixed_quality : 1;
|
||||
/** Enabling Tile part generation*/
|
||||
OPJ_BITFIELD m_tp_on : 1;
|
||||
}
|
||||
opj_encoding_param_t;
|
||||
|
||||
typedef struct opj_decoding_param {
|
||||
/** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */
|
||||
OPJ_UINT32 m_reduce;
|
||||
/** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */
|
||||
OPJ_UINT32 m_layer;
|
||||
}
|
||||
opj_decoding_param_t;
|
||||
|
||||
|
||||
/**
|
||||
* Coding parameters
|
||||
*/
|
||||
typedef struct opj_cp {
|
||||
/** Size of the image in bits*/
|
||||
/*int img_size;*/
|
||||
/** Rsiz*/
|
||||
OPJ_UINT16 rsiz;
|
||||
/** XTOsiz */
|
||||
OPJ_UINT32 tx0; /* MSD see norm */
|
||||
/** YTOsiz */
|
||||
OPJ_UINT32 ty0; /* MSD see norm */
|
||||
/** XTsiz */
|
||||
OPJ_UINT32 tdx;
|
||||
/** YTsiz */
|
||||
OPJ_UINT32 tdy;
|
||||
/** comment */
|
||||
OPJ_CHAR *comment;
|
||||
/** number of tiles in width */
|
||||
OPJ_UINT32 tw;
|
||||
/** number of tiles in height */
|
||||
OPJ_UINT32 th;
|
||||
|
||||
/** 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;
|
||||
/** size of the ppm_data*/
|
||||
OPJ_UINT32 ppm_data_read;
|
||||
|
||||
OPJ_BYTE *ppm_data_current;
|
||||
|
||||
/** packet header storage original buffer */
|
||||
OPJ_BYTE *ppm_buffer;
|
||||
/** pointer remaining on the first byte of the first header if ppm is used */
|
||||
OPJ_BYTE *ppm_data_first;
|
||||
/** Number of bytes actually stored inside the ppm_data */
|
||||
OPJ_UINT32 ppm_data_size;
|
||||
/** use in case of multiple marker PPM (number of info already store) */
|
||||
OPJ_INT32 ppm_store;
|
||||
/** use in case of multiple marker PPM (case on non-finished previous info) */
|
||||
OPJ_INT32 ppm_previous;
|
||||
|
||||
/** tile coding parameters */
|
||||
opj_tcp_t *tcps;
|
||||
|
||||
union {
|
||||
opj_decoding_param_t m_dec;
|
||||
opj_encoding_param_t m_enc;
|
||||
}
|
||||
m_specific_param;
|
||||
|
||||
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
/** enables writing of EPC in MH, thus activating JPWL */
|
||||
OPJ_BOOL epc_on;
|
||||
/** enables writing of EPB, in case of activated JPWL */
|
||||
OPJ_BOOL epb_on;
|
||||
/** enables writing of ESD, in case of activated JPWL */
|
||||
OPJ_BOOL esd_on;
|
||||
/** enables writing of informative techniques of ESD, in case of activated JPWL */
|
||||
OPJ_BOOL info_on;
|
||||
/** enables writing of RED, in case of activated JPWL */
|
||||
OPJ_BOOL red_on;
|
||||
/** error protection method for MH (0,1,16,32,37-128) */
|
||||
int hprot_MH;
|
||||
/** tile number of header protection specification (>=0) */
|
||||
int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
|
||||
/** error protection methods for TPHs (0,1,16,32,37-128) */
|
||||
int hprot_TPH[JPWL_MAX_NO_TILESPECS];
|
||||
/** tile number of packet protection specification (>=0) */
|
||||
int pprot_tileno[JPWL_MAX_NO_PACKSPECS];
|
||||
/** packet number of packet protection specification (>=0) */
|
||||
int pprot_packno[JPWL_MAX_NO_PACKSPECS];
|
||||
/** error protection methods for packets (0,1,16,32,37-128) */
|
||||
int pprot[JPWL_MAX_NO_PACKSPECS];
|
||||
/** enables writing of ESD, (0/2/4 bytes) */
|
||||
int sens_size;
|
||||
/** sensitivity addressing size (0=auto/2/4 bytes) */
|
||||
int sens_addr;
|
||||
/** sensitivity range (0-3) */
|
||||
int sens_range;
|
||||
/** sensitivity method for MH (-1,0-7) */
|
||||
int sens_MH;
|
||||
/** tile number of sensitivity specification (>=0) */
|
||||
int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
|
||||
/** sensitivity methods for TPHs (-1,0-7) */
|
||||
int sens_TPH[JPWL_MAX_NO_TILESPECS];
|
||||
/** enables JPWL correction at the decoder */
|
||||
OPJ_BOOL correct;
|
||||
/** expected number of components at the decoder */
|
||||
int exp_comps;
|
||||
/** maximum number of tiles at the decoder */
|
||||
OPJ_UINT32 max_tiles;
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
/******** FLAGS *********/
|
||||
/** if ppm == 1 --> there was a PPM marker*/
|
||||
OPJ_BITFIELD ppm : 1;
|
||||
/** tells if the parameter is a coding or decoding one */
|
||||
OPJ_BITFIELD m_is_decoder : 1;
|
||||
/** whether different bit depth or sign per component is allowed. Decoder only for ow */
|
||||
OPJ_BITFIELD allow_different_bit_depth_sign : 1;
|
||||
/* <<UniPG */
|
||||
} opj_cp_t;
|
||||
|
||||
|
||||
typedef struct opj_j2k_dec {
|
||||
/** locate in which part of the codestream the decoder is (main header, tile header, end) */
|
||||
OPJ_UINT32 m_state;
|
||||
/**
|
||||
* store decoding parameters common to all tiles (information like COD, COC in main header)
|
||||
*/
|
||||
opj_tcp_t *m_default_tcp;
|
||||
OPJ_BYTE *m_header_data;
|
||||
OPJ_UINT32 m_header_data_size;
|
||||
/** to tell the tile part length */
|
||||
OPJ_UINT32 m_sot_length;
|
||||
/** Only tiles index in the correct range will be decoded.*/
|
||||
OPJ_UINT32 m_start_tile_x;
|
||||
OPJ_UINT32 m_start_tile_y;
|
||||
OPJ_UINT32 m_end_tile_x;
|
||||
OPJ_UINT32 m_end_tile_y;
|
||||
|
||||
/** Index of the tile to decode (used in get_tile) */
|
||||
OPJ_INT32 m_tile_ind_to_dec;
|
||||
/** Position of the last SOT marker read */
|
||||
OPJ_OFF_T m_last_sot_read_pos;
|
||||
|
||||
/**
|
||||
* Indicate that the current tile-part is assume as the last tile part of the codestream.
|
||||
* It is useful in the case of PSot is equal to zero. The sot length will be compute in the
|
||||
* SOD reader function. FIXME NOT USED for the moment
|
||||
*/
|
||||
OPJ_BOOL m_last_tile_part;
|
||||
|
||||
OPJ_UINT32 m_numcomps_to_decode;
|
||||
OPJ_UINT32 *m_comps_indices_to_decode;
|
||||
|
||||
/** to tell that a tile can be decoded. */
|
||||
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;
|
||||
|
||||
typedef struct opj_j2k_enc {
|
||||
/** Tile part number, regardless of poc, for each new poc, tp is reset to 1*/
|
||||
OPJ_UINT32 m_current_poc_tile_part_number; /* tp_num */
|
||||
|
||||
/** Tile part number currently coding, taking into account POC. m_current_tile_part_number holds the total number of tile parts while encoding the last tile part.*/
|
||||
OPJ_UINT32 m_current_tile_part_number; /*cur_tp_num */
|
||||
|
||||
/**
|
||||
locate the start position of the TLM marker
|
||||
after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length.
|
||||
*/
|
||||
OPJ_OFF_T m_tlm_start;
|
||||
/**
|
||||
* Stores the sizes of the tlm.
|
||||
*/
|
||||
OPJ_BYTE * m_tlm_sot_offsets_buffer;
|
||||
/**
|
||||
* The current offset of the tlm buffer.
|
||||
*/
|
||||
OPJ_BYTE * m_tlm_sot_offsets_current;
|
||||
|
||||
/** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/
|
||||
/** used in TLMmarker*/
|
||||
OPJ_UINT32 m_total_tile_parts; /* totnum_tp */
|
||||
|
||||
/* encoded data for a tile */
|
||||
OPJ_BYTE * m_encoded_tile_data;
|
||||
|
||||
/* size of the encoded_data */
|
||||
OPJ_UINT32 m_encoded_tile_size;
|
||||
|
||||
/* encoded data for a tile */
|
||||
OPJ_BYTE * m_header_tile_data;
|
||||
|
||||
/* size of the encoded_data */
|
||||
OPJ_UINT32 m_header_tile_data_size;
|
||||
|
||||
|
||||
} opj_j2k_enc_t;
|
||||
|
||||
|
||||
|
||||
struct opj_tcd;
|
||||
/**
|
||||
JPEG-2000 codestream reader/writer
|
||||
*/
|
||||
typedef struct opj_j2k {
|
||||
/* J2K codestream is decoded*/
|
||||
OPJ_BOOL m_is_decoder;
|
||||
|
||||
/* FIXME DOC*/
|
||||
union {
|
||||
opj_j2k_dec_t m_decoder;
|
||||
opj_j2k_enc_t m_encoder;
|
||||
}
|
||||
m_specific_param;
|
||||
|
||||
/** pointer to the internal/private encoded / decoded image */
|
||||
opj_image_t* m_private_image;
|
||||
|
||||
/* pointer to the output image (decoded)*/
|
||||
opj_image_t* m_output_image;
|
||||
|
||||
/** Coding parameters */
|
||||
opj_cp_t m_cp;
|
||||
|
||||
/** the list of procedures to exec **/
|
||||
opj_procedure_list_t * m_procedure_list;
|
||||
|
||||
/** the list of validation procedures to follow to make sure the code is valid **/
|
||||
opj_procedure_list_t * m_validation_list;
|
||||
|
||||
/** helper used to write the index file */
|
||||
opj_codestream_index_t *cstr_index;
|
||||
|
||||
/** number of the tile currently concern by coding/decoding */
|
||||
OPJ_UINT32 m_current_tile_number;
|
||||
|
||||
/** 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_UINT32 ihdr_w;
|
||||
OPJ_UINT32 ihdr_h;
|
||||
OPJ_UINT32 enumcs;
|
||||
unsigned int dump_state;
|
||||
}
|
||||
opj_j2k_t;
|
||||
|
||||
|
||||
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Setup the decoder decoding parameters using user parameters.
|
||||
Decoding parameters are returned in j2k->cp.
|
||||
@param j2k J2K decompressor handle
|
||||
@param parameters decompression parameters
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return Returns a handle to a J2K compressor if successful, returns NULL otherwise
|
||||
*/
|
||||
opj_j2k_t* opj_j2k_create_compress(void);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
Converts an enum type progression order to string type
|
||||
*/
|
||||
const char *opj_j2k_convert_progression_order(OPJ_PROG_ORDER prg_order);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Ends the decompression procedures and possibiliy add data to be read after the
|
||||
* codestream.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_end_decompress(opj_j2k_t *j2k,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Reads a jpeg2000 codestream header structure.
|
||||
*
|
||||
* @param p_stream the stream to read data from.
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_manager the user event manager.
|
||||
*
|
||||
* @return true if the box is valid.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_read_header(opj_stream_private_t *p_stream,
|
||||
opj_j2k_t* p_j2k,
|
||||
opj_image_t** p_image,
|
||||
opj_event_mgr_t* p_manager);
|
||||
|
||||
|
||||
/**
|
||||
* Destroys a jpeg2000 codec.
|
||||
*
|
||||
* @param p_j2k the jpeg20000 structure to destroy.
|
||||
*/
|
||||
void opj_j2k_destroy(opj_j2k_t *p_j2k);
|
||||
|
||||
/**
|
||||
* Destroys a codestream index structure.
|
||||
*
|
||||
* @param p_cstr_ind the codestream index parameter to destroy.
|
||||
*/
|
||||
void j2k_destroy_cstr_index(opj_codestream_index_t *p_cstr_ind);
|
||||
|
||||
/**
|
||||
* Decode tile data.
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param p_tile_index
|
||||
* @param p_data FIXME DOC
|
||||
* @param p_data_size FIXME DOC
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_manager the user event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_decode_tile(opj_j2k_t * p_j2k,
|
||||
OPJ_UINT32 p_tile_index,
|
||||
OPJ_BYTE * p_data,
|
||||
OPJ_UINT32 p_data_size,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Reads a tile header.
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param p_tile_index FIXME DOC
|
||||
* @param p_data_size FIXME DOC
|
||||
* @param p_tile_x0 FIXME DOC
|
||||
* @param p_tile_y0 FIXME DOC
|
||||
* @param p_tile_x1 FIXME DOC
|
||||
* @param p_tile_y1 FIXME DOC
|
||||
* @param p_nb_comps FIXME DOC
|
||||
* @param p_go_on FIXME DOC
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_manager the user event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_read_tile_header(opj_j2k_t * p_j2k,
|
||||
OPJ_UINT32 * p_tile_index,
|
||||
OPJ_UINT32 * p_data_size,
|
||||
OPJ_INT32 * p_tile_x0,
|
||||
OPJ_INT32 * p_tile_y0,
|
||||
OPJ_INT32 * p_tile_x1,
|
||||
OPJ_INT32 * p_tile_y1,
|
||||
OPJ_UINT32 * p_nb_comps,
|
||||
OPJ_BOOL * p_go_on,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
|
||||
/** Sets the indices of the components to decode.
|
||||
*
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param numcomps Number of components to decode.
|
||||
* @param comps_indices Array of num_compts indices (numbering starting at 0)
|
||||
* corresponding to the components to decode.
|
||||
* @param p_manager Event manager
|
||||
*
|
||||
* @return OPJ_TRUE in case of success.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_set_decoded_components(opj_j2k_t *p_j2k,
|
||||
OPJ_UINT32 numcomps,
|
||||
const OPJ_UINT32* comps_indices,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading.
|
||||
*
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_start_x the left position of the rectangle to decode (in image coordinates).
|
||||
* @param p_start_y the up position of the rectangle to decode (in image coordinates).
|
||||
* @param p_end_x the right position of the rectangle to decode (in image coordinates).
|
||||
* @param p_end_y the bottom position of the rectangle to decode (in image coordinates).
|
||||
* @param p_manager the user event manager
|
||||
*
|
||||
* @return true if the area could be set.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_set_decode_area(opj_j2k_t *p_j2k,
|
||||
opj_image_t* p_image,
|
||||
OPJ_INT32 p_start_x, OPJ_INT32 p_start_y,
|
||||
OPJ_INT32 p_end_x, OPJ_INT32 p_end_y,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Creates a J2K decompression structure.
|
||||
*
|
||||
* @return a handle to a J2K decompressor if successful, NULL otherwise.
|
||||
*/
|
||||
opj_j2k_t* opj_j2k_create_decompress(void);
|
||||
|
||||
|
||||
/**
|
||||
* Dump some elements from the J2K decompression structure .
|
||||
*
|
||||
*@param p_j2k the jpeg2000 codec.
|
||||
*@param flag flag to describe what elements are dump.
|
||||
*@param out_stream output stream where dump the elements.
|
||||
*
|
||||
*/
|
||||
void j2k_dump(opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Dump an image header structure.
|
||||
*
|
||||
*@param image the image header to dump.
|
||||
*@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function
|
||||
*@param out_stream output stream where dump the elements.
|
||||
*/
|
||||
void j2k_dump_image_header(opj_image_t* image, OPJ_BOOL dev_dump_flag,
|
||||
FILE* out_stream);
|
||||
|
||||
/**
|
||||
* Dump a component image header structure.
|
||||
*
|
||||
*@param comp the component image header to dump.
|
||||
*@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function
|
||||
*@param out_stream output stream where dump the elements.
|
||||
*/
|
||||
void j2k_dump_image_comp_header(opj_image_comp_t* comp, OPJ_BOOL dev_dump_flag,
|
||||
FILE* out_stream);
|
||||
|
||||
/**
|
||||
* Get the codestream info from a JPEG2000 codec.
|
||||
*
|
||||
*@param p_j2k the component image header to dump.
|
||||
*
|
||||
*@return the codestream information extract from the jpg2000 codec
|
||||
*/
|
||||
opj_codestream_info_v2_t* j2k_get_cstr_info(opj_j2k_t* p_j2k);
|
||||
|
||||
/**
|
||||
* Get the codestream index from a JPEG2000 codec.
|
||||
*
|
||||
*@param p_j2k the component image header to dump.
|
||||
*
|
||||
*@return the codestream index extract from the jpg2000 codec
|
||||
*/
|
||||
opj_codestream_index_t* j2k_get_cstr_index(opj_j2k_t* p_j2k);
|
||||
|
||||
/**
|
||||
* Decode an image from a JPEG-2000 codestream
|
||||
* @param j2k J2K decompressor handle
|
||||
* @param p_stream FIXME DOC
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_manager FIXME DOC
|
||||
* @return FIXME DOC
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_decode(opj_j2k_t *j2k,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_image_t *p_image,
|
||||
opj_event_mgr_t *p_manager);
|
||||
|
||||
|
||||
OPJ_BOOL opj_j2k_get_tile(opj_j2k_t *p_j2k,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_image_t* p_image,
|
||||
opj_event_mgr_t * p_manager,
|
||||
OPJ_UINT32 tile_index);
|
||||
|
||||
OPJ_BOOL opj_j2k_set_decoded_resolution_factor(opj_j2k_t *p_j2k,
|
||||
OPJ_UINT32 res_factor,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
|
||||
/**
|
||||
* Writes a tile.
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param p_tile_index FIXME DOC
|
||||
* @param p_data FIXME DOC
|
||||
* @param p_data_size FIXME DOC
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_manager the user event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_write_tile(opj_j2k_t * p_j2k,
|
||||
OPJ_UINT32 p_tile_index,
|
||||
OPJ_BYTE * p_data,
|
||||
OPJ_UINT32 p_data_size,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Encodes an image into a JPEG-2000 codestream
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_encode(opj_j2k_t * p_j2k,
|
||||
opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Starts a compression scheme, i.e. validates the codec parameters, writes the header.
|
||||
*
|
||||
* @param p_j2k the jpeg2000 codec.
|
||||
* @param p_stream the stream object.
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_manager the user event manager.
|
||||
*
|
||||
* @return true if the codec is valid.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_start_compress(opj_j2k_t *p_j2k,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_image_t * p_image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Ends the compression procedures and possibiliy add data to be read after the
|
||||
* codestream.
|
||||
*/
|
||||
OPJ_BOOL opj_j2k_end_compress(opj_j2k_t *p_j2k,
|
||||
opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
OPJ_BOOL opj_j2k_setup_mct_encoding(opj_tcp_t * p_tcp, opj_image_t * p_image);
|
||||
|
||||
|
||||
#endif /* OPJ_J2K_H */
|
||||
Vendored
+3427
File diff suppressed because it is too large
Load Diff
Vendored
+498
@@ -0,0 +1,498 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef OPJ_JP2_H
|
||||
#define OPJ_JP2_H
|
||||
/**
|
||||
@file jp2.h
|
||||
@brief The JPEG-2000 file format Reader/Writer (JP2)
|
||||
|
||||
*/
|
||||
|
||||
/** @defgroup JP2 JP2 - JPEG-2000 file format reader/writer */
|
||||
/*@{*/
|
||||
|
||||
/*#define JPIP_JPIP 0x6a706970*/
|
||||
|
||||
#define JP2_JP 0x6a502020 /**< JPEG 2000 signature box */
|
||||
#define JP2_FTYP 0x66747970 /**< File type box */
|
||||
#define JP2_JP2H 0x6a703268 /**< JP2 header box (super-box) */
|
||||
#define JP2_IHDR 0x69686472 /**< Image header box */
|
||||
#define JP2_COLR 0x636f6c72 /**< Colour specification box */
|
||||
#define JP2_JP2C 0x6a703263 /**< Contiguous codestream box */
|
||||
#define JP2_URL 0x75726c20 /**< Data entry URL box */
|
||||
#define JP2_PCLR 0x70636c72 /**< Palette box */
|
||||
#define JP2_CMAP 0x636d6170 /**< Component Mapping box */
|
||||
#define JP2_CDEF 0x63646566 /**< Channel Definition box */
|
||||
#define JP2_DTBL 0x6474626c /**< Data Reference box */
|
||||
#define JP2_BPCC 0x62706363 /**< Bits per component box */
|
||||
#define JP2_JP2 0x6a703220 /**< File type fields */
|
||||
|
||||
/* For the future */
|
||||
/* #define JP2_RES 0x72657320 */ /**< Resolution box (super-box) */
|
||||
/* #define JP2_JP2I 0x6a703269 */ /**< Intellectual property box */
|
||||
/* #define JP2_XML 0x786d6c20 */ /**< XML box */
|
||||
/* #define JP2_UUID 0x75756994 */ /**< UUID box */
|
||||
/* #define JP2_UINF 0x75696e66 */ /**< UUID info box (super-box) */
|
||||
/* #define JP2_ULST 0x756c7374 */ /**< UUID list box */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
typedef enum {
|
||||
JP2_STATE_NONE = 0x0,
|
||||
JP2_STATE_SIGNATURE = 0x1,
|
||||
JP2_STATE_FILE_TYPE = 0x2,
|
||||
JP2_STATE_HEADER = 0x4,
|
||||
JP2_STATE_CODESTREAM = 0x8,
|
||||
JP2_STATE_END_CODESTREAM = 0x10,
|
||||
JP2_STATE_UNKNOWN = 0x7fffffff /* ISO C restricts enumerator values to range of 'int' */
|
||||
}
|
||||
JP2_STATE;
|
||||
|
||||
typedef enum {
|
||||
JP2_IMG_STATE_NONE = 0x0,
|
||||
JP2_IMG_STATE_UNKNOWN = 0x7fffffff
|
||||
}
|
||||
JP2_IMG_STATE;
|
||||
|
||||
/**
|
||||
Channel description: channel index, type, association
|
||||
*/
|
||||
typedef struct opj_jp2_cdef_info {
|
||||
OPJ_UINT16 cn, typ, asoc;
|
||||
} opj_jp2_cdef_info_t;
|
||||
|
||||
/**
|
||||
Channel descriptions and number of descriptions
|
||||
*/
|
||||
typedef struct opj_jp2_cdef {
|
||||
opj_jp2_cdef_info_t *info;
|
||||
OPJ_UINT16 n;
|
||||
} opj_jp2_cdef_t;
|
||||
|
||||
/**
|
||||
Component mappings: channel index, mapping type, palette index
|
||||
*/
|
||||
typedef struct opj_jp2_cmap_comp {
|
||||
OPJ_UINT16 cmp;
|
||||
OPJ_BYTE mtyp, pcol;
|
||||
} opj_jp2_cmap_comp_t;
|
||||
|
||||
/**
|
||||
Palette data: table entries, palette columns
|
||||
*/
|
||||
typedef struct opj_jp2_pclr {
|
||||
OPJ_UINT32 *entries;
|
||||
OPJ_BYTE *channel_sign;
|
||||
OPJ_BYTE *channel_size;
|
||||
opj_jp2_cmap_comp_t *cmap;
|
||||
OPJ_UINT16 nr_entries;
|
||||
OPJ_BYTE nr_channels;
|
||||
} opj_jp2_pclr_t;
|
||||
|
||||
/**
|
||||
Collector for ICC profile, palette, component mapping, channel description
|
||||
*/
|
||||
typedef struct opj_jp2_color {
|
||||
OPJ_BYTE *icc_profile_buf;
|
||||
OPJ_UINT32 icc_profile_len;
|
||||
|
||||
opj_jp2_cdef_t *jp2_cdef;
|
||||
opj_jp2_pclr_t *jp2_pclr;
|
||||
OPJ_BYTE jp2_has_colr;
|
||||
} opj_jp2_color_t;
|
||||
|
||||
/**
|
||||
JP2 component
|
||||
*/
|
||||
typedef struct opj_jp2_comps {
|
||||
OPJ_UINT32 depth;
|
||||
OPJ_UINT32 sgnd;
|
||||
OPJ_UINT32 bpcc;
|
||||
} opj_jp2_comps_t;
|
||||
|
||||
/**
|
||||
JPEG-2000 file format reader/writer
|
||||
*/
|
||||
typedef struct opj_jp2 {
|
||||
/** handle to the J2K codec */
|
||||
opj_j2k_t *j2k;
|
||||
/** list of validation procedures */
|
||||
struct opj_procedure_list * m_validation_list;
|
||||
/** list of execution procedures */
|
||||
struct opj_procedure_list * m_procedure_list;
|
||||
|
||||
/* width of image */
|
||||
OPJ_UINT32 w;
|
||||
/* height of image */
|
||||
OPJ_UINT32 h;
|
||||
/* number of components in the image */
|
||||
OPJ_UINT32 numcomps;
|
||||
OPJ_UINT32 bpc;
|
||||
OPJ_UINT32 C;
|
||||
OPJ_UINT32 UnkC;
|
||||
OPJ_UINT32 IPR;
|
||||
OPJ_UINT32 meth;
|
||||
OPJ_UINT32 approx;
|
||||
OPJ_UINT32 enumcs;
|
||||
OPJ_UINT32 precedence;
|
||||
OPJ_UINT32 brand;
|
||||
OPJ_UINT32 minversion;
|
||||
OPJ_UINT32 numcl;
|
||||
OPJ_UINT32 *cl;
|
||||
opj_jp2_comps_t *comps;
|
||||
/* FIXME: The following two variables are used to save offset
|
||||
as we write out a JP2 file to disk. This mechanism is not flexible
|
||||
as codec writers will need to extand those fields as new part
|
||||
of the standard are implemented.
|
||||
*/
|
||||
OPJ_OFF_T j2k_codestream_offset;
|
||||
OPJ_OFF_T jpip_iptr_offset;
|
||||
OPJ_BOOL jpip_on;
|
||||
OPJ_UINT32 jp2_state;
|
||||
OPJ_UINT32 jp2_img_state;
|
||||
|
||||
opj_jp2_color_t color;
|
||||
|
||||
OPJ_BOOL ignore_pclr_cmap_cdef;
|
||||
OPJ_BYTE has_jp2h;
|
||||
OPJ_BYTE has_ihdr;
|
||||
}
|
||||
opj_jp2_t;
|
||||
|
||||
/**
|
||||
JP2 Box
|
||||
*/
|
||||
typedef struct opj_jp2_box {
|
||||
OPJ_UINT32 length;
|
||||
OPJ_UINT32 type;
|
||||
OPJ_INT32 init_pos;
|
||||
} opj_jp2_box_t;
|
||||
|
||||
typedef struct opj_jp2_header_handler {
|
||||
/* marker value */
|
||||
OPJ_UINT32 id;
|
||||
/* action linked to the marker */
|
||||
OPJ_BOOL(*handler)(opj_jp2_t *jp2,
|
||||
OPJ_BYTE *p_header_data,
|
||||
OPJ_UINT32 p_header_size,
|
||||
opj_event_mgr_t * p_manager);
|
||||
}
|
||||
opj_jp2_header_handler_t;
|
||||
|
||||
|
||||
typedef struct opj_jp2_img_header_writer_handler {
|
||||
/* action to perform */
|
||||
OPJ_BYTE* (*handler)(opj_jp2_t *jp2, OPJ_UINT32 * p_data_size);
|
||||
/* result of the action : data */
|
||||
OPJ_BYTE* m_data;
|
||||
/* size of data */
|
||||
OPJ_UINT32 m_size;
|
||||
}
|
||||
opj_jp2_img_header_writer_handler_t;
|
||||
|
||||
/** @name Exported functions */
|
||||
/*@{*/
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Setup the decoder decoding parameters using user parameters.
|
||||
Decoding parameters are returned in jp2->j2k->cp.
|
||||
@param jp2 JP2 decompressor handle
|
||||
@param parameters decompression parameters
|
||||
*/
|
||||
void opj_jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters);
|
||||
|
||||
/** Allocates worker threads for the compressor/decompressor.
|
||||
*
|
||||
* @param jp2 JP2 decompressor handle
|
||||
* @param num_threads Number of threads.
|
||||
* @return OPJ_TRUE in case of success.
|
||||
*/
|
||||
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
|
||||
* @param p_stream FIXME DOC
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_manager FIXME DOC
|
||||
*
|
||||
* @return Returns a decoded image if successful, returns NULL otherwise
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_image_t* p_image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Setup the encoder parameters using the current image and using user parameters.
|
||||
* Coding parameters are returned in jp2->j2k->cp.
|
||||
*
|
||||
* @param jp2 JP2 compressor handle
|
||||
* @param parameters compression parameters
|
||||
* @param image input filled image
|
||||
* @param p_manager FIXME DOC
|
||||
* @return OPJ_TRUE if successful, OPJ_FALSE otherwise
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_setup_encoder(opj_jp2_t *jp2,
|
||||
opj_cparameters_t *parameters,
|
||||
opj_image_t *image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
Encode an image into a JPEG-2000 file stream
|
||||
@param jp2 JP2 compressor handle
|
||||
@param stream Output buffer stream
|
||||
@param p_manager event manager
|
||||
@return Returns true if successful, returns false otherwise
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_encode(opj_jp2_t *jp2,
|
||||
opj_stream_private_t *stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
|
||||
/**
|
||||
* Starts a compression scheme, i.e. validates the codec parameters, writes the header.
|
||||
*
|
||||
* @param jp2 the jpeg2000 file codec.
|
||||
* @param stream the stream object.
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_manager FIXME DOC
|
||||
*
|
||||
* @return true if the codec is valid.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_start_compress(opj_jp2_t *jp2,
|
||||
opj_stream_private_t *stream,
|
||||
opj_image_t * p_image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
|
||||
/**
|
||||
* Ends the compression procedures and possibiliy add data to be read after the
|
||||
* codestream.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_end_compress(opj_jp2_t *jp2,
|
||||
opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Ends the decompression procedures and possibiliy add data to be read after the
|
||||
* codestream.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_end_decompress(opj_jp2_t *jp2,
|
||||
opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Reads a jpeg2000 file header structure.
|
||||
*
|
||||
* @param p_stream the stream to read data from.
|
||||
* @param jp2 the jpeg2000 file header structure.
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_manager the user event manager.
|
||||
*
|
||||
* @return true if the box is valid.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_read_header(opj_stream_private_t *p_stream,
|
||||
opj_jp2_t *jp2,
|
||||
opj_image_t ** p_image,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/** Sets the indices of the components to decode.
|
||||
*
|
||||
* @param jp2 JP2 decompressor handle
|
||||
* @param numcomps Number of components to decode.
|
||||
* @param comps_indices Array of num_compts indices (numbering starting at 0)
|
||||
* corresponding to the components to decode.
|
||||
* @param p_manager Event manager;
|
||||
*
|
||||
* @return OPJ_TRUE in case of success.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_set_decoded_components(opj_jp2_t *jp2,
|
||||
OPJ_UINT32 numcomps,
|
||||
const OPJ_UINT32* comps_indices,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Reads a tile header.
|
||||
* @param p_jp2 the jpeg2000 codec.
|
||||
* @param p_tile_index FIXME DOC
|
||||
* @param p_data_size FIXME DOC
|
||||
* @param p_tile_x0 FIXME DOC
|
||||
* @param p_tile_y0 FIXME DOC
|
||||
* @param p_tile_x1 FIXME DOC
|
||||
* @param p_tile_y1 FIXME DOC
|
||||
* @param p_nb_comps FIXME DOC
|
||||
* @param p_go_on FIXME DOC
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_manager the user event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_read_tile_header(opj_jp2_t * p_jp2,
|
||||
OPJ_UINT32 * p_tile_index,
|
||||
OPJ_UINT32 * p_data_size,
|
||||
OPJ_INT32 * p_tile_x0,
|
||||
OPJ_INT32 * p_tile_y0,
|
||||
OPJ_INT32 * p_tile_x1,
|
||||
OPJ_INT32 * p_tile_y1,
|
||||
OPJ_UINT32 * p_nb_comps,
|
||||
OPJ_BOOL * p_go_on,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Writes a tile.
|
||||
*
|
||||
* @param p_jp2 the jpeg2000 codec.
|
||||
* @param p_tile_index FIXME DOC
|
||||
* @param p_data FIXME DOC
|
||||
* @param p_data_size FIXME DOC
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_manager the user event manager.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_write_tile(opj_jp2_t *p_jp2,
|
||||
OPJ_UINT32 p_tile_index,
|
||||
OPJ_BYTE * p_data,
|
||||
OPJ_UINT32 p_data_size,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Decode tile data.
|
||||
* @param p_jp2 the jpeg2000 codec.
|
||||
* @param p_tile_index FIXME DOC
|
||||
* @param p_data FIXME DOC
|
||||
* @param p_data_size FIXME DOC
|
||||
* @param p_stream the stream to write data to.
|
||||
* @param p_manager the user event manager.
|
||||
*
|
||||
* @return FIXME DOC
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_decode_tile(opj_jp2_t * p_jp2,
|
||||
OPJ_UINT32 p_tile_index,
|
||||
OPJ_BYTE * p_data,
|
||||
OPJ_UINT32 p_data_size,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
* Creates a jpeg2000 file decompressor.
|
||||
*
|
||||
* @return an empty jpeg2000 file codec.
|
||||
*/
|
||||
opj_jp2_t* opj_jp2_create(OPJ_BOOL p_is_decoder);
|
||||
|
||||
/**
|
||||
Destroy a JP2 decompressor handle
|
||||
@param jp2 JP2 decompressor handle to destroy
|
||||
*/
|
||||
void opj_jp2_destroy(opj_jp2_t *jp2);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading.
|
||||
*
|
||||
* @param p_jp2 the jpeg2000 codec.
|
||||
* @param p_image FIXME DOC
|
||||
* @param p_start_x the left position of the rectangle to decode (in image coordinates).
|
||||
* @param p_start_y the up position of the rectangle to decode (in image coordinates).
|
||||
* @param p_end_x the right position of the rectangle to decode (in image coordinates).
|
||||
* @param p_end_y the bottom position of the rectangle to decode (in image coordinates).
|
||||
* @param p_manager the user event manager
|
||||
*
|
||||
* @return true if the area could be set.
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_set_decode_area(opj_jp2_t *p_jp2,
|
||||
opj_image_t* p_image,
|
||||
OPJ_INT32 p_start_x, OPJ_INT32 p_start_y,
|
||||
OPJ_INT32 p_end_x, OPJ_INT32 p_end_y,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_get_tile(opj_jp2_t *p_jp2,
|
||||
opj_stream_private_t *p_stream,
|
||||
opj_image_t* p_image,
|
||||
opj_event_mgr_t * p_manager,
|
||||
OPJ_UINT32 tile_index);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
OPJ_BOOL opj_jp2_set_decoded_resolution_factor(opj_jp2_t *p_jp2,
|
||||
OPJ_UINT32 res_factor,
|
||||
opj_event_mgr_t * p_manager);
|
||||
|
||||
|
||||
/* TODO MSD: clean these 3 functions */
|
||||
/**
|
||||
* Dump some elements from the JP2 decompression structure .
|
||||
*
|
||||
*@param p_jp2 the jp2 codec.
|
||||
*@param flag flag to describe what elements are dump.
|
||||
*@param out_stream output stream where dump the elements.
|
||||
*
|
||||
*/
|
||||
void jp2_dump(opj_jp2_t* p_jp2, OPJ_INT32 flag, FILE* out_stream);
|
||||
|
||||
/**
|
||||
* Get the codestream info from a JPEG2000 codec.
|
||||
*
|
||||
*@param p_jp2 jp2 codec.
|
||||
*
|
||||
*@return the codestream information extract from the jpg2000 codec
|
||||
*/
|
||||
opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_t* p_jp2);
|
||||
|
||||
/**
|
||||
* Get the codestream index from a JPEG2000 codec.
|
||||
*
|
||||
*@param p_jp2 jp2 codec.
|
||||
*
|
||||
*@return the codestream index extract from the jpg2000 codec
|
||||
*/
|
||||
opj_codestream_index_t* jp2_get_cstr_index(opj_jp2_t* p_jp2);
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* OPJ_JP2_H */
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
bindir=${prefix}/@OPENJPEG_INSTALL_BIN_DIR@
|
||||
mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
|
||||
docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
|
||||
libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
|
||||
includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
|
||||
|
||||
Name: openjp2
|
||||
Description: JPEG2000 library (Part 1 and 2)
|
||||
URL: http://www.openjpeg.org/
|
||||
Version: @OPENJPEG_VERSION@
|
||||
Libs: -L${libdir} -lopenjp2
|
||||
Libs.private: -lm
|
||||
Cflags: -I${includedir}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user