mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Compare commits
624 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 371bba8f54 | |||
| 2eaf35eb63 | |||
| 0b9d53829f | |||
| c9fc27b337 | |||
| aa1359dc19 | |||
| 4c2100e02c | |||
| 473941c341 | |||
| 4001346a30 | |||
| ee7255aac4 | |||
| 5dc606097c | |||
| 14843679af | |||
| 785a540ebd | |||
| d2854448c2 | |||
| cd6d8048bb | |||
| 3d7a3a51a7 | |||
| b4e2c99346 | |||
| 33dde339fe | |||
| 066c074b66 | |||
| 142a524d2f | |||
| 7142f46d1c | |||
| f2803aba07 | |||
| 45428b897f | |||
| 50a6f9d251 | |||
| 360758e8ae | |||
| 8afb2f0cb7 | |||
| 7442100caa | |||
| 52cd1dacbf | |||
| 62775660d1 | |||
| f75152a597 | |||
| b761ec0132 | |||
| c7c987843c | |||
| 73191ad3ec | |||
| 769d2f4c44 | |||
| 90df5e00b4 | |||
| 8c25a8eb7b | |||
| f147ba16e2 | |||
| c43371f190 | |||
| fbed33cc1f | |||
| a509ec0d91 | |||
| 40da61a314 | |||
| f473b61585 | |||
| 6501cb93a4 | |||
| 0d1a0b126b | |||
| 9a202c1522 | |||
| e8a0bc5794 | |||
| e783e6677e | |||
| 8518d078d7 | |||
| 3a1ccd5f43 | |||
| 6e90b85cae | |||
| dd2823aaec | |||
| 00171ca935 | |||
| 9c748beef5 | |||
| 26087e28ad | |||
| 17ad33c919 | |||
| 1ed47900d8 | |||
| d338644159 | |||
| bd1fd59fc1 | |||
| 1fa3d21f6a | |||
| 3f42122387 | |||
| f73b4f4a26 | |||
| a534af68b8 | |||
| 6e2ede8c56 | |||
| 8c0b0714e7 | |||
| 55f02d8c66 | |||
| 49093d6d38 | |||
| d71977b4dd | |||
| a1ef612662 | |||
| 4f9a99141e | |||
| 713d91b04e | |||
| 332c37f332 | |||
| b46fa2e556 | |||
| 25a9a32f8e | |||
| 11fd9e5fdc | |||
| 403f11fdbf | |||
| b4cba524d3 | |||
| 746cd1e1e6 | |||
| 19cf511895 | |||
| 6b31f58092 | |||
| 7444f0c651 | |||
| dd37c10d4a | |||
| dd262b7087 | |||
| 65e76adeda | |||
| c0d41f05d6 | |||
| 9a6f2630b2 | |||
| 939ea4ba30 | |||
| c3cf35ab63 | |||
| 4188e8aaf9 | |||
| 9702987209 | |||
| 8bde6aea4b | |||
| f1d9666a20 | |||
| c0076b58cd | |||
| 00e8c7810f | |||
| 322115bfcf | |||
| a6160b6994 | |||
| abfcb60118 | |||
| 406392e13d | |||
| 7b7d21ebef | |||
| 54a1bbe1c4 | |||
| caf438c63b | |||
| dfef04b325 | |||
| f8ac46ba07 | |||
| 997b7b18af | |||
| f414c16c13 | |||
| c6f39870ff | |||
| b1cc114b7b | |||
| 766fd20faa | |||
| 315e7fbbee | |||
| fcec053d59 | |||
| d073215f10 | |||
| 665408e57f | |||
| ea3dc78986 | |||
| a65ccc0603 | |||
| e2dbf054ac | |||
| 62f3c9bfa9 | |||
| 287ee9d0ea | |||
| 3c6d5aba22 | |||
| eeb6f7726e | |||
| 631b246881 | |||
| e1c8256602 | |||
| 5728679fd5 | |||
| a6af9c75e9 | |||
| 6de86e325f | |||
| 48e471fdd4 | |||
| e5917a8fa5 | |||
| 49a43dfc8f | |||
| 40959fcc61 | |||
| 55770c9853 | |||
| 2ea4626911 | |||
| c8a89134a7 | |||
| 53c2ebf7f6 | |||
| 7e2ebecd52 | |||
| 581d0ef8a9 | |||
| a9c1af39d6 | |||
| 5f419c014f | |||
| ed7607935e | |||
| 78da679472 | |||
| 2f89158339 | |||
| 27d15894d8 | |||
| 79e13be04c | |||
| c72a855214 | |||
| fd08d0d80d | |||
| d93ec07dd8 | |||
| 6b96512d46 | |||
| a9cf01113a | |||
| 85ade61ef7 | |||
| 3d44e9ad92 | |||
| a8fb72a807 | |||
| 73959fed45 | |||
| e267342108 | |||
| 757411bffc | |||
| 6142b21dd5 | |||
| b363489702 | |||
| dae03273cd | |||
| be6a837e15 | |||
| e1f5b886fb | |||
| c9ad5779f2 | |||
| 26c5b0c71f | |||
| 1dee705074 | |||
| f9c951440d | |||
| 578ea4bae9 | |||
| 6bcf0b5519 | |||
| e82d03ef61 | |||
| eedd7bfd50 | |||
| cbf80117af | |||
| 2b35c1708b | |||
| e093a19c70 | |||
| 6fbcb283b9 | |||
| 7fb70e1701 | |||
| 2fb409b286 | |||
| d5f430cc11 | |||
| fd27d5ea00 | |||
| 493611ace5 | |||
| e058febaad | |||
| d7f60f69f1 | |||
| 4b33910449 | |||
| 0c16d8f6c3 | |||
| 5340073770 | |||
| 384ac63490 | |||
| d38676085a | |||
| d8583b2c7a | |||
| 82227b5ace | |||
| c8f934b5b1 | |||
| a4111fab39 | |||
| 54de51ef3c | |||
| 0915df5b18 | |||
| 81e7c7d8c8 | |||
| ea64e860de | |||
| e70786e05e | |||
| cab15f6c5e | |||
| e82e672a93 | |||
| 93971a53d9 | |||
| 09b3dcb6db | |||
| ef42baf9f0 | |||
| e55ad25355 | |||
| 80a3d7bffa | |||
| 6481397710 | |||
| 388ccda85d | |||
| 2e0150e601 | |||
| 2dc5e245d0 | |||
| ea3a5950a3 | |||
| 4e8311085f | |||
| cf0be1a0af | |||
| c577c2cc6a | |||
| 905d96dd4a | |||
| 197285d12a | |||
| ab430b8c87 | |||
| d1029faa90 | |||
| 6374b99a1a | |||
| 4fb9bce79f | |||
| 487f631243 | |||
| c928c21fe7 | |||
| 59fa477edb | |||
| 992d5b8bcd | |||
| 6808d33b2f | |||
| 966f27df34 | |||
| 21bb17e3ee | |||
| 4ba4901ca9 | |||
| 9de63c1edd | |||
| 51cc78b2a2 | |||
| 8f4e5c2fb8 | |||
| db1c8b3f9e | |||
| f07856eab9 | |||
| dd952f6d68 | |||
| e63efe2978 | |||
| fb6929ac3d | |||
| 4e65283081 | |||
| c6daa4aa16 | |||
| c0016d7fe9 | |||
| a518e7063d | |||
| de8696aa43 | |||
| 02cc1cd6e6 | |||
| 0e6cf41923 | |||
| 7579cd8068 | |||
| b6a447798a | |||
| 9344d0d0e3 | |||
| 7fa7fa0226 | |||
| a3df05d93b | |||
| 798e2779f2 | |||
| 1b13df5368 | |||
| 083332f85f | |||
| 6757c2c5a6 | |||
| 59e2ca16d9 | |||
| 75ed282b20 | |||
| 754956857c | |||
| a4ab60920f | |||
| a574788e89 | |||
| 22dbcf98c5 | |||
| d7540c9a3c | |||
| bea312bd65 | |||
| 3705648c9b | |||
| 940dc1f2b7 | |||
| f54b230906 | |||
| 3bbc4e44c3 | |||
| f81370232a | |||
| 85fad1504a | |||
| 1d10d56651 | |||
| ef5d921eac | |||
| 8409aa9eba | |||
| ca9aa180c1 | |||
| ce46cc9852 | |||
| 39f327acdb | |||
| 6189b47648 | |||
| dd6f5949c2 | |||
| a62539489d | |||
| d6b2739525 | |||
| 846a500fb4 | |||
| 8b7f805642 | |||
| cc5190eb91 | |||
| 4eff798270 | |||
| 4e40e5bb88 | |||
| a456b968cf | |||
| a6387c3012 | |||
| 5f2074d757 | |||
| 2a9c81eb25 | |||
| 65fb8ae33e | |||
| dc88c9f3a2 | |||
| fc3fc6005e | |||
| 27fd913c86 | |||
| e0e828ef5c | |||
| 9992c4d275 | |||
| ab65b9745b | |||
| 4e3ab026fe | |||
| f5b212a9d4 | |||
| e31eb46123 | |||
| 326be0d7ba | |||
| e5c39ed48a | |||
| 0d65397ae7 | |||
| a7f30391d0 | |||
| c96850ba59 | |||
| 5459c11e99 | |||
| e755a2a6e4 | |||
| 1913482cf5 | |||
| c7d04c6c5c | |||
| 1ba7c728a6 | |||
| be9b676db3 | |||
| 75a6eaf147 | |||
| 10e1c2b3cd | |||
| a1dd30ed50 | |||
| f74f1a94fe | |||
| 96bf26611e | |||
| 841741aa52 | |||
| 8f15a609af | |||
| 8cdf7bb84b | |||
| 6fb780eae6 | |||
| 858ba6c798 | |||
| 386733aea1 | |||
| 11eafca3e2 | |||
| 5087ff0814 | |||
| ebc8015638 | |||
| 35c7cab742 | |||
| c1921f1b12 | |||
| 9b978afaa2 | |||
| 997ad12730 | |||
| 777eaa7352 | |||
| bb61a2547a | |||
| 5869415a57 | |||
| b5248da826 | |||
| b059a361dd | |||
| 3c99dc96b1 | |||
| dadba232de | |||
| 787f5236a9 | |||
| 31498ebbea | |||
| 9636ffc471 | |||
| b17e1531d2 | |||
| 05dc645b81 | |||
| d4f038dfcc | |||
| c972c94662 | |||
| 33c9d57c6f | |||
| 2c6f1ab57d | |||
| 000110e760 | |||
| 7a686a0c43 | |||
| 835e4b6de9 | |||
| 0a5301bc5b | |||
| 3a4bc0d41e | |||
| cfb02b5370 | |||
| b8175f8976 | |||
| 182f43b6f9 | |||
| 6d2a97e954 | |||
| 66e4ace39f | |||
| a920ed9e1e | |||
| 6c8ec5336f | |||
| 687fa6a8ca | |||
| 32797515de | |||
| 0f622206e4 | |||
| ca55982669 | |||
| ea67060081 | |||
| 2dfaad3259 | |||
| 06ffa408ce | |||
| 34e9d1eb3c | |||
| 3914c17b0d | |||
| c92e0838c1 | |||
| 443fed796a | |||
| 08536943ad | |||
| 936523ae52 | |||
| 7fff245f87 | |||
| 6e3ea8b49d | |||
| 220b278575 | |||
| 2b022311a4 | |||
| 853f5111c2 | |||
| 65ab6ed59f | |||
| 389aae59ae | |||
| c9abb823a7 | |||
| e6dd9a78ae | |||
| e0c888acf7 | |||
| 50bec53afc | |||
| 828091cfbb | |||
| eb981cc7d7 | |||
| 31be03a805 | |||
| ca3848d773 | |||
| e6d9486a6c | |||
| 9a8e47a766 | |||
| 13f244b6a5 | |||
| 28556f1498 | |||
| 0ccd810738 | |||
| e959f449ae | |||
| e4aea680b9 | |||
| 5d3822f15e | |||
| 465ae048a0 | |||
| 71009c9b4d | |||
| dbed39a931 | |||
| ea31c09384 | |||
| 329a1fb781 | |||
| 043e7e3516 | |||
| 9c23f2f1a6 | |||
| 5e9750d1f5 | |||
| 2180a67670 | |||
| 1188c6fe14 | |||
| a2e754c136 | |||
| 5339ef3004 | |||
| 6a2b3c8d4c | |||
| edacd91a27 | |||
| 5dd46b54c1 | |||
| ea502b6e84 | |||
| 954536073d | |||
| cc45c10f3d | |||
| 13aa23f706 | |||
| 78b51fb574 | |||
| 922d5796b9 | |||
| f0ddc2a53c | |||
| d5d059690f | |||
| fd832bb57d | |||
| 09cb329d73 | |||
| 4a9291fd89 | |||
| 5115e5decb | |||
| 1ed9ff17e1 | |||
| f1fdfa1a51 | |||
| 0f3fe957f5 | |||
| fc4679d4cf | |||
| 35c53204cb | |||
| f731515628 | |||
| 59bf2a34fa | |||
| abbb73e894 | |||
| dada5a422d | |||
| 8bb3d363a4 | |||
| 1522722fab | |||
| 8f1f4273a2 | |||
| a9c8a526cf | |||
| 699db77293 | |||
| 690fb0544c | |||
| ae4c72a153 | |||
| ea92c2b1a6 | |||
| 9ac7aea930 | |||
| 5f17cc1abd | |||
| 8f6695acc7 | |||
| 9524abcd28 | |||
| 83efde6243 | |||
| 8eb987e393 | |||
| 2c6ab65476 | |||
| 66fdddc339 | |||
| 5575171652 | |||
| a8b0db4e5d | |||
| e104fcc000 | |||
| e4f71994c2 | |||
| 29e88e50ff | |||
| 852f061b26 | |||
| f0d277e452 | |||
| 2e8483bd1c | |||
| 3eec8fd0eb | |||
| d8d025c33b | |||
| 8811dabbac | |||
| efca746d36 | |||
| e0f524d3b7 | |||
| d1c842cf29 | |||
| 4d23a5d92d | |||
| 0739d1c2eb | |||
| 475c775b25 | |||
| b7e8ce4523 | |||
| e8fcd721b8 | |||
| ef5579dc86 | |||
| 84ae8097b1 | |||
| 295b988657 | |||
| 68942affdb | |||
| e0980c4d73 | |||
| c5920df159 | |||
| 86ddff0b88 | |||
| 908978d00b | |||
| a956732874 | |||
| 879e046b22 | |||
| 5fb0f34e8a | |||
| 861415133e | |||
| fce75cd858 | |||
| b6d5565df1 | |||
| 53ad291ef1 | |||
| 145d3ba99d | |||
| e6171d17f8 | |||
| aa1c86f95e | |||
| 699565828d | |||
| 38de2a8754 | |||
| 8b661cde15 | |||
| e628fd7bce | |||
| 808ba552c5 | |||
| a024593fa6 | |||
| 87b5737293 | |||
| b80c978f5d | |||
| 10ae0c4364 | |||
| cb3ae1232b | |||
| e73e393c82 | |||
| b01f63835e | |||
| 6d7f5871db | |||
| 89720ae24d | |||
| 9097ccf515 | |||
| dca657a2fd | |||
| df8b057b44 | |||
| 64b3c1e691 | |||
| 15aee09c7f | |||
| 80610ca054 | |||
| fd0df5a89b | |||
| b487e2df0b | |||
| c6ed2bf9aa | |||
| 40b1dc12de | |||
| 8eba3c1e7e | |||
| b50c70bbfa | |||
| af021e79d9 | |||
| 73bfe68821 | |||
| 4a73b4859f | |||
| f5d181db3a | |||
| da7e1cfb49 | |||
| 43b64140ae | |||
| d74b98c3d9 | |||
| e0bfe44cac | |||
| 10fb88d027 | |||
| f826709452 | |||
| f10fd64630 | |||
| 09837928d9 | |||
| dce4e94f02 | |||
| ee6415bd1c | |||
| 78835ad87a | |||
| 4e6be21a44 | |||
| f89e4e7dd0 | |||
| dfa8467a08 | |||
| 669ee0415a | |||
| 367668710c | |||
| 94dea84915 | |||
| 9f1218b00b | |||
| fcfa488250 | |||
| 2bbe31a8f6 | |||
| 7cdb0eafeb | |||
| 90f47eb952 | |||
| 15e57d28f5 | |||
| 532eace7d6 | |||
| d4ac4fcde1 | |||
| c1db75e0c7 | |||
| acfdd0e1fc | |||
| 9fb8f6347f | |||
| 7f73b105ca | |||
| ae8dcdf40d | |||
| ee1e1ce377 | |||
| 6d165dae5e | |||
| 335e61dc47 | |||
| 64380baa85 | |||
| b5eb65e53e | |||
| f1ca05c822 | |||
| 900df21b7d | |||
| 93bad514a8 | |||
| d8cd1d8fcc | |||
| 6356403964 | |||
| e8a14a775e | |||
| 7b90a1e85a | |||
| 49283ec035 | |||
| 7d4bb9428b | |||
| 76eb389761 | |||
| e9a1ccb89a | |||
| db262fa76a | |||
| 4e59d6fd12 | |||
| e136c11c7c | |||
| 0e80f56e44 | |||
| 94758c18de | |||
| e76b375a31 | |||
| 9f5f64e14e | |||
| 4eb2966559 | |||
| 293facbae7 | |||
| 053259fd92 | |||
| da41ac9e60 | |||
| 82c477c9f7 | |||
| 57bead3a5e | |||
| d044ac1c66 | |||
| 9787ab598b | |||
| 7e9b5d9e30 | |||
| 3d141280aa | |||
| 9df7517dea | |||
| 4560909a5e | |||
| 3f65924c45 | |||
| 5e31c82b5b | |||
| 4382bdc859 | |||
| fa66c6b797 | |||
| 2da96be217 | |||
| 43f821afb9 | |||
| 3165baa1f1 | |||
| 9a8a964b69 | |||
| 17888ce0fd | |||
| 051b40f956 | |||
| cc8db99695 | |||
| b39cd06249 | |||
| 46def2fdc1 | |||
| 2195f0cc62 | |||
| 387e92353c | |||
| 2047abd9c3 | |||
| 64f2b1b250 | |||
| 577546ccd9 | |||
| e858c21e1f | |||
| 0d6518aaa0 | |||
| d1a598c652 | |||
| bfc227b8d4 | |||
| 45dd575ed2 | |||
| 80709697e5 | |||
| 1b53a4fccc | |||
| 4bb220bb90 | |||
| e1b3cf5c14 | |||
| 0f298a4203 | |||
| 5e68f35500 | |||
| ba1bd64bf9 | |||
| db88cd1b25 | |||
| 936d2963a2 | |||
| 4378b4d03d | |||
| 6ddef3b7a9 | |||
| 68c92908d5 | |||
| 51e543050c | |||
| 000a13b6a3 | |||
| 84b3b5b4a4 | |||
| 4e83f4c579 | |||
| cd2b188c9a | |||
| 1e0a60be2a | |||
| fc5bba66af | |||
| 4d7d630e92 | |||
| 4b2d1aaeea | |||
| 7e5581cd86 | |||
| 8b6a6d4546 | |||
| 7ae83df8aa | |||
| 779a42678d | |||
| 10ba6a93a6 | |||
| c917be2189 | |||
| c6aa97c9aa | |||
| 250941bd47 | |||
| 5b17a60dde | |||
| b07f772f36 | |||
| d4688e6474 | |||
| e7e29cb63c | |||
| ca922443db | |||
| 2385a5870e | |||
| e567135ed3 | |||
| 98c8584b88 | |||
| 2b2fa58f97 | |||
| 2d54fed3cc | |||
| 964a4d75b4 |
@@ -2,6 +2,14 @@
|
|||||||
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
|
If you have a question rather than reporting a bug please go to http://answers.opencv.org where you get much faster responses.
|
||||||
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
|
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).
|
||||||
|
|
||||||
|
Please:
|
||||||
|
|
||||||
|
* Read the documentation to test with the latest developer build.
|
||||||
|
* Check if other person has already created the same issue to avoid duplicates. You can comment on it if there already is an issue.
|
||||||
|
* Try to be as detailed as possible in your report.
|
||||||
|
* Report only one problem per created issue.
|
||||||
|
|
||||||
|
|
||||||
This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
|
This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@@ -27,4 +35,4 @@ This is a template helping you to create an issue which can be processed as quic
|
|||||||
// C++ code example
|
// C++ code example
|
||||||
```
|
```
|
||||||
or attach as .txt or .zip file
|
or attach as .txt or .zip file
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -22,5 +22,3 @@ bin/
|
|||||||
*.log
|
*.log
|
||||||
*.tlog
|
*.tlog
|
||||||
build
|
build
|
||||||
node_modules
|
|
||||||
CMakeSettings.json
|
|
||||||
|
|||||||
Vendored
+2
-5
@@ -20,11 +20,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
# - matchTemplate about 5-10%
|
# - matchTemplate about 5-10%
|
||||||
# - goodFeaturesToTrack 10-20%
|
# - goodFeaturesToTrack 10-20%
|
||||||
# - cornerHarris 30% for some cases
|
# - cornerHarris 30% for some cases
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0.0")
|
|
||||||
set_source_files_properties(${carotene_sources} COMPILE_FLAGS "--param ipcp-unit-growth=100000 --param inline-unit-growth=100000 --param large-stack-frame-growth=5000")
|
set_source_files_properties(${carotene_sources} COMPILE_FLAGS "--param ipcp-unit-growth=100000 --param inline-unit-growth=100000 --param large-stack-frame-growth=5000")
|
||||||
else()
|
|
||||||
set_source_files_properties(${carotene_sources} COMPILE_FLAGS "--param ipa-cp-unit-growth=100000 --param inline-unit-growth=100000 --param large-stack-frame-growth=5000")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(carotene_objs OBJECT
|
add_library(carotene_objs OBJECT
|
||||||
|
|||||||
Vendored
+19
-5
@@ -12,6 +12,8 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64.*|AARCH64.*")
|
|||||||
set(AARCH64 TRUE)
|
set(AARCH64 TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-function)
|
||||||
|
|
||||||
set(TEGRA_COMPILER_FLAGS "")
|
set(TEGRA_COMPILER_FLAGS "")
|
||||||
|
|
||||||
if(CV_GCC OR CV_CLANG)
|
if(CV_GCC OR CV_CLANG)
|
||||||
@@ -58,6 +60,22 @@ function(compile_carotene)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory("${CAROTENE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/carotene")
|
add_subdirectory("${CAROTENE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/carotene")
|
||||||
|
|
||||||
|
if(ARM OR AARCH64)
|
||||||
|
if(CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
|
||||||
|
endif()
|
||||||
|
check_cxx_compiler_flag("-mfpu=neon" CXX_HAS_MFPU_NEON)
|
||||||
|
check_c_compiler_flag("-mfpu=neon" C_HAS_MFPU_NEON)
|
||||||
|
if(${CXX_HAS_MFPU_NEON} AND ${C_HAS_MFPU_NEON} AND NOT "${CMAKE_CXX_FLAGS} " MATCHES "-mfpu=neon[^ ]*")
|
||||||
|
get_target_property(old_flags "carotene_objs" COMPILE_FLAGS)
|
||||||
|
if(old_flags)
|
||||||
|
set_target_properties("carotene_objs" PROPERTIES COMPILE_FLAGS "${old_flags} -mfpu=neon")
|
||||||
|
else()
|
||||||
|
set_target_properties("carotene_objs" PROPERTIES COMPILE_FLAGS "-mfpu=neon")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
compile_carotene()
|
compile_carotene()
|
||||||
@@ -72,11 +90,7 @@ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${carotene_defs})
|
|||||||
# matchTemplate about 5-10%
|
# matchTemplate about 5-10%
|
||||||
# goodFeaturesToTrack 10-20%
|
# goodFeaturesToTrack 10-20%
|
||||||
# cornerHarris 30% for some cases
|
# cornerHarris 30% for some cases
|
||||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0.0")
|
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")
|
||||||
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")
|
|
||||||
else()
|
|
||||||
set_source_files_properties(impl.cpp $<TARGET_OBJECTS:carotene_objs> COMPILE_FLAGS "--param ipa-cp-unit-growth=100000 --param inline-unit-growth=100000 --param large-stack-frame-growth=5000")
|
|
||||||
endif()
|
|
||||||
# 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")
|
# 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()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Vendored
-2
@@ -1127,7 +1127,6 @@ inline int TEGRA_FILTERINIT(cvhalFilter2D **context, uchar *kernel_data, size_t
|
|||||||
{
|
{
|
||||||
std::memcpy(ctx->kernel_data + kernel_width * j, kernel_data + kernel_step * j, kernel_width * sizeof(int16_t));
|
std::memcpy(ctx->kernel_data + kernel_width * j, kernel_data + kernel_step * j, kernel_width * sizeof(int16_t));
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
delete[] ctx->kernel_data;
|
delete[] ctx->kernel_data;
|
||||||
delete ctx;
|
delete ctx;
|
||||||
@@ -1244,7 +1243,6 @@ inline int TEGRA_SEPFILTERINIT(cvhalFilter2D **context, int src_type, int dst_ty
|
|||||||
ctx->kernely_data[0]=((int16_t*)kernely_data)[0];
|
ctx->kernely_data[0]=((int16_t*)kernely_data)[0];
|
||||||
ctx->kernely_data[1]=((int16_t*)kernely_data)[1];
|
ctx->kernely_data[1]=((int16_t*)kernely_data)[1];
|
||||||
ctx->kernely_data[2]=((int16_t*)kernely_data)[2];
|
ctx->kernely_data[2]=((int16_t*)kernely_data)[2];
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
delete ctx;
|
delete ctx;
|
||||||
return CV_HAL_ERROR_NOT_IMPLEMENTED;
|
return CV_HAL_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|||||||
+4
-4
@@ -49,12 +49,12 @@ namespace {
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SHIFT = 14,
|
SHIFT = 15,
|
||||||
SHIFT_DELTA = 1 << (SHIFT - 1),
|
SHIFT_DELTA = 1 << (SHIFT - 1),
|
||||||
|
|
||||||
R2Y_BT601 = 4899,
|
R2Y_BT601 = 9798,
|
||||||
G2Y_BT601 = 9617,
|
G2Y_BT601 = 19235,
|
||||||
B2Y_BT601 = 1868,
|
B2Y_BT601 = 3735,
|
||||||
|
|
||||||
R2Y_BT709 = 3483,
|
R2Y_BT709 = 3483,
|
||||||
G2Y_BT709 = 11718,
|
G2Y_BT709 = 11718,
|
||||||
|
|||||||
Vendored
+22
-36
@@ -151,6 +151,10 @@ void div(const Size2D &size,
|
|||||||
typedef typename internal::VecTraits<T>::vec128 vec128;
|
typedef typename internal::VecTraits<T>::vec128 vec128;
|
||||||
typedef typename internal::VecTraits<T>::vec64 vec64;
|
typedef typename internal::VecTraits<T>::vec64 vec64;
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||||
|
static_assert(std::numeric_limits<T>::is_integer, "template implementation is for integer types only");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (scale == 0.0f ||
|
if (scale == 0.0f ||
|
||||||
(std::numeric_limits<T>::is_integer &&
|
(std::numeric_limits<T>::is_integer &&
|
||||||
(scale * std::numeric_limits<T>::max()) < 1.0f &&
|
(scale * std::numeric_limits<T>::max()) < 1.0f &&
|
||||||
@@ -311,6 +315,10 @@ void recip(const Size2D &size,
|
|||||||
typedef typename internal::VecTraits<T>::vec128 vec128;
|
typedef typename internal::VecTraits<T>::vec128 vec128;
|
||||||
typedef typename internal::VecTraits<T>::vec64 vec64;
|
typedef typename internal::VecTraits<T>::vec64 vec64;
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && (defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
|
||||||
|
static_assert(std::numeric_limits<T>::is_integer, "template implementation is for integer types only");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (scale == 0.0f ||
|
if (scale == 0.0f ||
|
||||||
(std::numeric_limits<T>::is_integer &&
|
(std::numeric_limits<T>::is_integer &&
|
||||||
scale < 1.0f &&
|
scale < 1.0f &&
|
||||||
@@ -463,8 +471,6 @@ void div(const Size2D &size,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
|
||||||
|
|
||||||
size_t roiw128 = size.width >= 3 ? size.width - 3 : 0;
|
size_t roiw128 = size.width >= 3 ? size.width - 3 : 0;
|
||||||
size_t roiw64 = size.width >= 1 ? size.width - 1 : 0;
|
size_t roiw64 = size.width >= 1 ? size.width - 1 : 0;
|
||||||
|
|
||||||
@@ -485,9 +491,7 @@ void div(const Size2D &size,
|
|||||||
float32x4_t v_src0 = vld1q_f32(src0 + j);
|
float32x4_t v_src0 = vld1q_f32(src0 + j);
|
||||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||||
|
|
||||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
vst1q_f32(dst + j, vmulq_f32(v_src0, internal::vrecpq_f32(v_src1)));
|
||||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
|
||||||
vreinterpretq_u32_f32(vmulq_f32(v_src0, internal::vrecpq_f32(v_src1))), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < roiw64; j += 2)
|
for (; j < roiw64; j += 2)
|
||||||
@@ -495,14 +499,12 @@ void div(const Size2D &size,
|
|||||||
float32x2_t v_src0 = vld1_f32(src0 + j);
|
float32x2_t v_src0 = vld1_f32(src0 + j);
|
||||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||||
|
|
||||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
vst1_f32(dst + j, vmul_f32(v_src0, internal::vrecp_f32(v_src1)));
|
||||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
|
||||||
vreinterpret_u32_f32(vmul_f32(v_src0, internal::vrecp_f32(v_src1))), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < size.width; j++)
|
for (; j < size.width; j++)
|
||||||
{
|
{
|
||||||
dst[j] = src1[j] ? src0[j] / src1[j] : 0.0f;
|
dst[j] = src0[j] / src1[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,10 +525,8 @@ void div(const Size2D &size,
|
|||||||
float32x4_t v_src0 = vld1q_f32(src0 + j);
|
float32x4_t v_src0 = vld1q_f32(src0 + j);
|
||||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||||
|
|
||||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
vst1q_f32(dst + j, vmulq_f32(vmulq_n_f32(v_src0, scale),
|
||||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
internal::vrecpq_f32(v_src1)));
|
||||||
vreinterpretq_u32_f32(vmulq_f32(vmulq_n_f32(v_src0, scale),
|
|
||||||
internal::vrecpq_f32(v_src1))), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < roiw64; j += 2)
|
for (; j < roiw64; j += 2)
|
||||||
@@ -534,15 +534,13 @@ void div(const Size2D &size,
|
|||||||
float32x2_t v_src0 = vld1_f32(src0 + j);
|
float32x2_t v_src0 = vld1_f32(src0 + j);
|
||||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||||
|
|
||||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
vst1_f32(dst + j, vmul_f32(vmul_n_f32(v_src0, scale),
|
||||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
internal::vrecp_f32(v_src1)));
|
||||||
vreinterpret_u32_f32(vmul_f32(vmul_n_f32(v_src0, scale),
|
|
||||||
internal::vrecp_f32(v_src1))), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < size.width; j++)
|
for (; j < size.width; j++)
|
||||||
{
|
{
|
||||||
dst[j] = src1[j] ? src0[j] * scale / src1[j] : 0.0f;
|
dst[j] = src0[j] * scale / src1[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -620,8 +618,6 @@ void reciprocal(const Size2D &size,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
|
||||||
|
|
||||||
size_t roiw128 = size.width >= 3 ? size.width - 3 : 0;
|
size_t roiw128 = size.width >= 3 ? size.width - 3 : 0;
|
||||||
size_t roiw64 = size.width >= 1 ? size.width - 1 : 0;
|
size_t roiw64 = size.width >= 1 ? size.width - 1 : 0;
|
||||||
|
|
||||||
@@ -639,23 +635,19 @@ void reciprocal(const Size2D &size,
|
|||||||
|
|
||||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||||
|
|
||||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
vst1q_f32(dst + j, internal::vrecpq_f32(v_src1));
|
||||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
|
||||||
vreinterpretq_u32_f32(internal::vrecpq_f32(v_src1)), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < roiw64; j += 2)
|
for (; j < roiw64; j += 2)
|
||||||
{
|
{
|
||||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||||
|
|
||||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
vst1_f32(dst + j, internal::vrecp_f32(v_src1));
|
||||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
|
||||||
vreinterpret_u32_f32(internal::vrecp_f32(v_src1)), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < size.width; j++)
|
for (; j < size.width; j++)
|
||||||
{
|
{
|
||||||
dst[j] = src1[j] ? 1.0f / src1[j] : 0;
|
dst[j] = 1.0f / src1[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -673,25 +665,19 @@ void reciprocal(const Size2D &size,
|
|||||||
|
|
||||||
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
float32x4_t v_src1 = vld1q_f32(src1 + j);
|
||||||
|
|
||||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
vst1q_f32(dst + j, vmulq_n_f32(internal::vrecpq_f32(v_src1), scale));
|
||||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
|
||||||
vreinterpretq_u32_f32(vmulq_n_f32(internal::vrecpq_f32(v_src1),
|
|
||||||
scale)),v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < roiw64; j += 2)
|
for (; j < roiw64; j += 2)
|
||||||
{
|
{
|
||||||
float32x2_t v_src1 = vld1_f32(src1 + j);
|
float32x2_t v_src1 = vld1_f32(src1 + j);
|
||||||
|
|
||||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
vst1_f32(dst + j, vmul_n_f32(internal::vrecp_f32(v_src1), scale));
|
||||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
|
||||||
vreinterpret_u32_f32(vmul_n_f32(internal::vrecp_f32(v_src1),
|
|
||||||
scale)), v_mask)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; j < size.width; j++)
|
for (; j < size.width; j++)
|
||||||
{
|
{
|
||||||
dst[j] = src1[j] ? scale / src1[j] : 0;
|
dst[j] = scale / src1[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
|||||||
Vendored
+6
-6
@@ -1,9 +1,9 @@
|
|||||||
# Binaries branch name: ffmpeg/3.4_20200310
|
# Binaries branch name: ffmpeg/master_20181106
|
||||||
# Binaries were created for OpenCV: 4966186e10e2a940514d8c20447ca4a828af5f46
|
# Binaries were created for OpenCV: 2c6f1ab57d4250ee46e32d1b51c056431965b470
|
||||||
ocv_update(FFMPEG_BINARIES_COMMIT "e81ccda615672833b578c6cefdb859ad69c560ba")
|
ocv_update(FFMPEG_BINARIES_COMMIT "759a23e24ab787a0979f8a93103dcc3105ec10c1")
|
||||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "301ae2000e25f800ab8e0065f277ad28")
|
ocv_update(FFMPEG_FILE_HASH_BIN32 "849286ccc527c99e5a218b67f13c6e8c")
|
||||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "d87ce032289c3f811d02f0c3d8dbe366")
|
ocv_update(FFMPEG_FILE_HASH_BIN64 "96444a4645753aaafa296479665c9185")
|
||||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "3b90f67f4b429e77d3da36698cef700c")
|
ocv_update(FFMPEG_FILE_HASH_CMAKE "f710891525a04586d565d0e700e62a9c")
|
||||||
|
|
||||||
function(download_win_ffmpeg script_var)
|
function(download_win_ffmpeg script_var)
|
||||||
set(${script_var} "" PARENT_SCOPE)
|
set(${script_var} "" PARENT_SCOPE)
|
||||||
|
|||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
//
|
||||||
|
// File: vk_platform.h
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2014-2017 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef VK_PLATFORM_H_
|
||||||
|
#define VK_PLATFORM_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
/*
|
||||||
|
***************************************************************************************************
|
||||||
|
* Platform-specific directives and type declarations
|
||||||
|
***************************************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Platform-specific calling convention macros.
|
||||||
|
*
|
||||||
|
* Platforms should define these so that Vulkan clients call Vulkan commands
|
||||||
|
* with the same calling conventions that the Vulkan implementation expects.
|
||||||
|
*
|
||||||
|
* VKAPI_ATTR - Placed before the return type in function declarations.
|
||||||
|
* Useful for C++11 and GCC/Clang-style function attribute syntax.
|
||||||
|
* VKAPI_CALL - Placed after the return type in function declarations.
|
||||||
|
* Useful for MSVC-style calling convention syntax.
|
||||||
|
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
|
||||||
|
*
|
||||||
|
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
|
||||||
|
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
|
||||||
|
*/
|
||||||
|
#if defined(_WIN32)
|
||||||
|
// On Windows, Vulkan commands use the stdcall convention
|
||||||
|
#define VKAPI_ATTR
|
||||||
|
#define VKAPI_CALL __stdcall
|
||||||
|
#define VKAPI_PTR VKAPI_CALL
|
||||||
|
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||||
|
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
|
||||||
|
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||||
|
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
|
||||||
|
// calling convention, i.e. float parameters are passed in registers. This
|
||||||
|
// is true even if the rest of the application passes floats on the stack,
|
||||||
|
// as it does by default when compiling for the armeabi-v7a NDK ABI.
|
||||||
|
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
|
||||||
|
#define VKAPI_CALL
|
||||||
|
#define VKAPI_PTR VKAPI_ATTR
|
||||||
|
#else
|
||||||
|
// On other platforms, use the default calling convention
|
||||||
|
#define VKAPI_ATTR
|
||||||
|
#define VKAPI_CALL
|
||||||
|
#define VKAPI_PTR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#if !defined(VK_NO_STDINT_H)
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||||
|
typedef signed __int8 int8_t;
|
||||||
|
typedef unsigned __int8 uint8_t;
|
||||||
|
typedef signed __int16 int16_t;
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
#endif // !defined(VK_NO_STDINT_H)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+83
@@ -0,0 +1,83 @@
|
|||||||
|
#ifndef VULKAN_H_
|
||||||
|
#define VULKAN_H_ 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "vk_platform.h"
|
||||||
|
#include "vulkan_core.h"
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||||
|
#include "vulkan_android.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||||
|
#include <zircon/types.h>
|
||||||
|
#include "vulkan_fuchsia.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_IOS_MVK
|
||||||
|
#include "vulkan_ios.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_MACOS_MVK
|
||||||
|
#include "vulkan_macos.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||||
|
#include <mir_toolkit/client_types.h>
|
||||||
|
#include "vulkan_mir.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_VI_NN
|
||||||
|
#include "vulkan_vi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||||
|
#include <wayland-client.h>
|
||||||
|
#include "vulkan_wayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||||
|
#include <windows.h>
|
||||||
|
#include "vulkan_win32.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
#include "vulkan_xcb.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include "vulkan_xlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/extensions/Xrandr.h>
|
||||||
|
#include "vulkan_xlib_xrandr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // VULKAN_H_
|
||||||
+126
@@ -0,0 +1,126 @@
|
|||||||
|
#ifndef VULKAN_ANDROID_H_
|
||||||
|
#define VULKAN_ANDROID_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_android_surface 1
|
||||||
|
struct ANativeWindow;
|
||||||
|
|
||||||
|
#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6
|
||||||
|
#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkAndroidSurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
|
typedef struct VkAndroidSurfaceCreateInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkAndroidSurfaceCreateFlagsKHR flags;
|
||||||
|
struct ANativeWindow* window;
|
||||||
|
} VkAndroidSurfaceCreateInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_ANDROID_external_memory_android_hardware_buffer 1
|
||||||
|
struct AHardwareBuffer;
|
||||||
|
|
||||||
|
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 3
|
||||||
|
#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer"
|
||||||
|
|
||||||
|
typedef struct VkAndroidHardwareBufferUsageANDROID {
|
||||||
|
VkStructureType sType;
|
||||||
|
void* pNext;
|
||||||
|
uint64_t androidHardwareBufferUsage;
|
||||||
|
} VkAndroidHardwareBufferUsageANDROID;
|
||||||
|
|
||||||
|
typedef struct VkAndroidHardwareBufferPropertiesANDROID {
|
||||||
|
VkStructureType sType;
|
||||||
|
void* pNext;
|
||||||
|
VkDeviceSize allocationSize;
|
||||||
|
uint32_t memoryTypeBits;
|
||||||
|
} VkAndroidHardwareBufferPropertiesANDROID;
|
||||||
|
|
||||||
|
typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID {
|
||||||
|
VkStructureType sType;
|
||||||
|
void* pNext;
|
||||||
|
VkFormat format;
|
||||||
|
uint64_t externalFormat;
|
||||||
|
VkFormatFeatureFlags formatFeatures;
|
||||||
|
VkComponentMapping samplerYcbcrConversionComponents;
|
||||||
|
VkSamplerYcbcrModelConversion suggestedYcbcrModel;
|
||||||
|
VkSamplerYcbcrRange suggestedYcbcrRange;
|
||||||
|
VkChromaLocation suggestedXChromaOffset;
|
||||||
|
VkChromaLocation suggestedYChromaOffset;
|
||||||
|
} VkAndroidHardwareBufferFormatPropertiesANDROID;
|
||||||
|
|
||||||
|
typedef struct VkImportAndroidHardwareBufferInfoANDROID {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
struct AHardwareBuffer* buffer;
|
||||||
|
} VkImportAndroidHardwareBufferInfoANDROID;
|
||||||
|
|
||||||
|
typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkDeviceMemory memory;
|
||||||
|
} VkMemoryGetAndroidHardwareBufferInfoANDROID;
|
||||||
|
|
||||||
|
typedef struct VkExternalFormatANDROID {
|
||||||
|
VkStructureType sType;
|
||||||
|
void* pNext;
|
||||||
|
uint64_t externalFormat;
|
||||||
|
} VkExternalFormatANDROID;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID(
|
||||||
|
VkDevice device,
|
||||||
|
const struct AHardwareBuffer* buffer,
|
||||||
|
VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID(
|
||||||
|
VkDevice device,
|
||||||
|
const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo,
|
||||||
|
struct AHardwareBuffer** pBuffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+8524
File diff suppressed because it is too large
Load Diff
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef VULKAN_FUCHSIA_H_
|
||||||
|
#define VULKAN_FUCHSIA_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_FUCHSIA_imagepipe_surface 1
|
||||||
|
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1
|
||||||
|
#define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkImagePipeSurfaceCreateFlagsFUCHSIA;
|
||||||
|
|
||||||
|
typedef struct VkImagePipeSurfaceCreateInfoFUCHSIA {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkImagePipeSurfaceCreateFlagsFUCHSIA flags;
|
||||||
|
zx_handle_t imagePipeHandle;
|
||||||
|
} VkImagePipeSurfaceCreateInfoFUCHSIA;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateImagePipeSurfaceFUCHSIA)(VkInstance instance, const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkImagePipeSurfaceCreateInfoFUCHSIA* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef VULKAN_IOS_H_
|
||||||
|
#define VULKAN_IOS_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_MVK_ios_surface 1
|
||||||
|
#define VK_MVK_IOS_SURFACE_SPEC_VERSION 2
|
||||||
|
#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkIOSSurfaceCreateFlagsMVK;
|
||||||
|
|
||||||
|
typedef struct VkIOSSurfaceCreateInfoMVK {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkIOSSurfaceCreateFlagsMVK flags;
|
||||||
|
const void* pView;
|
||||||
|
} VkIOSSurfaceCreateInfoMVK;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkIOSSurfaceCreateInfoMVK* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef VULKAN_MACOS_H_
|
||||||
|
#define VULKAN_MACOS_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_MVK_macos_surface 1
|
||||||
|
#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2
|
||||||
|
#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
|
||||||
|
|
||||||
|
typedef struct VkMacOSSurfaceCreateInfoMVK {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkMacOSSurfaceCreateFlagsMVK flags;
|
||||||
|
const void* pView;
|
||||||
|
} VkMacOSSurfaceCreateInfoMVK;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkMacOSSurfaceCreateInfoMVK* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+65
@@ -0,0 +1,65 @@
|
|||||||
|
#ifndef VULKAN_MIR_H_
|
||||||
|
#define VULKAN_MIR_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_mir_surface 1
|
||||||
|
#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4
|
||||||
|
#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkMirSurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
|
typedef struct VkMirSurfaceCreateInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkMirSurfaceCreateFlagsKHR flags;
|
||||||
|
MirConnection* connection;
|
||||||
|
MirSurface* mirSurface;
|
||||||
|
} VkMirSurfaceCreateInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkMirSurfaceCreateInfoKHR* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
uint32_t queueFamilyIndex,
|
||||||
|
MirConnection* connection);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#ifndef VULKAN_VI_H_
|
||||||
|
#define VULKAN_VI_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_NN_vi_surface 1
|
||||||
|
#define VK_NN_VI_SURFACE_SPEC_VERSION 1
|
||||||
|
#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkViSurfaceCreateFlagsNN;
|
||||||
|
|
||||||
|
typedef struct VkViSurfaceCreateInfoNN {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkViSurfaceCreateFlagsNN flags;
|
||||||
|
void* window;
|
||||||
|
} VkViSurfaceCreateInfoNN;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkViSurfaceCreateInfoNN* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+65
@@ -0,0 +1,65 @@
|
|||||||
|
#ifndef VULKAN_WAYLAND_H_
|
||||||
|
#define VULKAN_WAYLAND_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_wayland_surface 1
|
||||||
|
#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6
|
||||||
|
#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkWaylandSurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
|
typedef struct VkWaylandSurfaceCreateInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkWaylandSurfaceCreateFlagsKHR flags;
|
||||||
|
struct wl_display* display;
|
||||||
|
struct wl_surface* surface;
|
||||||
|
} VkWaylandSurfaceCreateInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
uint32_t queueFamilyIndex,
|
||||||
|
struct wl_display* display);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+276
@@ -0,0 +1,276 @@
|
|||||||
|
#ifndef VULKAN_WIN32_H_
|
||||||
|
#define VULKAN_WIN32_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_win32_surface 1
|
||||||
|
#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6
|
||||||
|
#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkWin32SurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
|
typedef struct VkWin32SurfaceCreateInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkWin32SurfaceCreateFlagsKHR flags;
|
||||||
|
HINSTANCE hinstance;
|
||||||
|
HWND hwnd;
|
||||||
|
} VkWin32SurfaceCreateInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
uint32_t queueFamilyIndex);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_KHR_external_memory_win32 1
|
||||||
|
#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||||
|
#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32"
|
||||||
|
|
||||||
|
typedef struct VkImportMemoryWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||||
|
HANDLE handle;
|
||||||
|
LPCWSTR name;
|
||||||
|
} VkImportMemoryWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkExportMemoryWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
const SECURITY_ATTRIBUTES* pAttributes;
|
||||||
|
DWORD dwAccess;
|
||||||
|
LPCWSTR name;
|
||||||
|
} VkExportMemoryWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkMemoryWin32HandlePropertiesKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
void* pNext;
|
||||||
|
uint32_t memoryTypeBits;
|
||||||
|
} VkMemoryWin32HandlePropertiesKHR;
|
||||||
|
|
||||||
|
typedef struct VkMemoryGetWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkDeviceMemory memory;
|
||||||
|
VkExternalMemoryHandleTypeFlagBits handleType;
|
||||||
|
} VkMemoryGetWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(
|
||||||
|
VkDevice device,
|
||||||
|
const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||||
|
HANDLE* pHandle);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(
|
||||||
|
VkDevice device,
|
||||||
|
VkExternalMemoryHandleTypeFlagBits handleType,
|
||||||
|
HANDLE handle,
|
||||||
|
VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_KHR_win32_keyed_mutex 1
|
||||||
|
#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||||
|
#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex"
|
||||||
|
|
||||||
|
typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
uint32_t acquireCount;
|
||||||
|
const VkDeviceMemory* pAcquireSyncs;
|
||||||
|
const uint64_t* pAcquireKeys;
|
||||||
|
const uint32_t* pAcquireTimeouts;
|
||||||
|
uint32_t releaseCount;
|
||||||
|
const VkDeviceMemory* pReleaseSyncs;
|
||||||
|
const uint64_t* pReleaseKeys;
|
||||||
|
} VkWin32KeyedMutexAcquireReleaseInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_external_semaphore_win32 1
|
||||||
|
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1
|
||||||
|
#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32"
|
||||||
|
|
||||||
|
typedef struct VkImportSemaphoreWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkSemaphore semaphore;
|
||||||
|
VkSemaphoreImportFlags flags;
|
||||||
|
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||||
|
HANDLE handle;
|
||||||
|
LPCWSTR name;
|
||||||
|
} VkImportSemaphoreWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkExportSemaphoreWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
const SECURITY_ATTRIBUTES* pAttributes;
|
||||||
|
DWORD dwAccess;
|
||||||
|
LPCWSTR name;
|
||||||
|
} VkExportSemaphoreWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkD3D12FenceSubmitInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
uint32_t waitSemaphoreValuesCount;
|
||||||
|
const uint64_t* pWaitSemaphoreValues;
|
||||||
|
uint32_t signalSemaphoreValuesCount;
|
||||||
|
const uint64_t* pSignalSemaphoreValues;
|
||||||
|
} VkD3D12FenceSubmitInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkSemaphoreGetWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkSemaphore semaphore;
|
||||||
|
VkExternalSemaphoreHandleTypeFlagBits handleType;
|
||||||
|
} VkSemaphoreGetWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR(
|
||||||
|
VkDevice device,
|
||||||
|
const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(
|
||||||
|
VkDevice device,
|
||||||
|
const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||||
|
HANDLE* pHandle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_KHR_external_fence_win32 1
|
||||||
|
#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1
|
||||||
|
#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32"
|
||||||
|
|
||||||
|
typedef struct VkImportFenceWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkFence fence;
|
||||||
|
VkFenceImportFlags flags;
|
||||||
|
VkExternalFenceHandleTypeFlagBits handleType;
|
||||||
|
HANDLE handle;
|
||||||
|
LPCWSTR name;
|
||||||
|
} VkImportFenceWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkExportFenceWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
const SECURITY_ATTRIBUTES* pAttributes;
|
||||||
|
DWORD dwAccess;
|
||||||
|
LPCWSTR name;
|
||||||
|
} VkExportFenceWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
typedef struct VkFenceGetWin32HandleInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkFence fence;
|
||||||
|
VkExternalFenceHandleTypeFlagBits handleType;
|
||||||
|
} VkFenceGetWin32HandleInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR(
|
||||||
|
VkDevice device,
|
||||||
|
const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(
|
||||||
|
VkDevice device,
|
||||||
|
const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo,
|
||||||
|
HANDLE* pHandle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_NV_external_memory_win32 1
|
||||||
|
#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||||
|
#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
|
||||||
|
|
||||||
|
typedef struct VkImportMemoryWin32HandleInfoNV {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkExternalMemoryHandleTypeFlagsNV handleType;
|
||||||
|
HANDLE handle;
|
||||||
|
} VkImportMemoryWin32HandleInfoNV;
|
||||||
|
|
||||||
|
typedef struct VkExportMemoryWin32HandleInfoNV {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
const SECURITY_ATTRIBUTES* pAttributes;
|
||||||
|
DWORD dwAccess;
|
||||||
|
} VkExportMemoryWin32HandleInfoNV;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
|
||||||
|
VkDevice device,
|
||||||
|
VkDeviceMemory memory,
|
||||||
|
VkExternalMemoryHandleTypeFlagsNV handleType,
|
||||||
|
HANDLE* pHandle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VK_NV_win32_keyed_mutex 1
|
||||||
|
#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||||
|
#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
|
||||||
|
|
||||||
|
typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
uint32_t acquireCount;
|
||||||
|
const VkDeviceMemory* pAcquireSyncs;
|
||||||
|
const uint64_t* pAcquireKeys;
|
||||||
|
const uint32_t* pAcquireTimeoutMilliseconds;
|
||||||
|
uint32_t releaseCount;
|
||||||
|
const VkDeviceMemory* pReleaseSyncs;
|
||||||
|
const uint64_t* pReleaseKeys;
|
||||||
|
} VkWin32KeyedMutexAcquireReleaseInfoNV;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#ifndef VULKAN_XCB_H_
|
||||||
|
#define VULKAN_XCB_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_xcb_surface 1
|
||||||
|
#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6
|
||||||
|
#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkXcbSurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
|
typedef struct VkXcbSurfaceCreateInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkXcbSurfaceCreateFlagsKHR flags;
|
||||||
|
xcb_connection_t* connection;
|
||||||
|
xcb_window_t window;
|
||||||
|
} VkXcbSurfaceCreateInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
uint32_t queueFamilyIndex,
|
||||||
|
xcb_connection_t* connection,
|
||||||
|
xcb_visualid_t visual_id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#ifndef VULKAN_XLIB_H_
|
||||||
|
#define VULKAN_XLIB_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_KHR_xlib_surface 1
|
||||||
|
#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6
|
||||||
|
#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface"
|
||||||
|
|
||||||
|
typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
|
||||||
|
|
||||||
|
typedef struct VkXlibSurfaceCreateInfoKHR {
|
||||||
|
VkStructureType sType;
|
||||||
|
const void* pNext;
|
||||||
|
VkXlibSurfaceCreateFlagsKHR flags;
|
||||||
|
Display* dpy;
|
||||||
|
Window window;
|
||||||
|
} VkXlibSurfaceCreateInfoKHR;
|
||||||
|
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
|
||||||
|
typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(
|
||||||
|
VkInstance instance,
|
||||||
|
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
|
||||||
|
const VkAllocationCallbacks* pAllocator,
|
||||||
|
VkSurfaceKHR* pSurface);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
uint32_t queueFamilyIndex,
|
||||||
|
Display* dpy,
|
||||||
|
VisualID visualID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
#ifndef VULKAN_XLIB_XRANDR_H_
|
||||||
|
#define VULKAN_XLIB_XRANDR_H_ 1
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copyright (c) 2015-2018 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is generated from the Khronos Vulkan XML API Registry.
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define VK_EXT_acquire_xlib_display 1
|
||||||
|
#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1
|
||||||
|
#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display"
|
||||||
|
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display);
|
||||||
|
typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay);
|
||||||
|
|
||||||
|
#ifndef VK_NO_PROTOTYPES
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
Display* dpy,
|
||||||
|
VkDisplayKHR display);
|
||||||
|
|
||||||
|
VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(
|
||||||
|
VkPhysicalDevice physicalDevice,
|
||||||
|
Display* dpy,
|
||||||
|
RROutput rrOutput,
|
||||||
|
VkDisplayKHR* pDisplay);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
Vendored
+16
-11
@@ -2,32 +2,37 @@ function(download_ippicv root_var)
|
|||||||
set(${root_var} "" PARENT_SCOPE)
|
set(${root_var} "" PARENT_SCOPE)
|
||||||
|
|
||||||
# Commit SHA in the opencv_3rdparty repo
|
# Commit SHA in the opencv_3rdparty repo
|
||||||
set(IPPICV_COMMIT "a56b6ac6f030c312b2dce17430eef13aed9af274")
|
set(IPPICV_COMMIT "32e315a5b106a7b89dbed51c28f8120a48b368b4")
|
||||||
# Define actual ICV versions
|
# Define actual ICV versions
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(OPENCV_ICV_PLATFORM "macosx")
|
set(OPENCV_ICV_PLATFORM "macosx")
|
||||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_mac")
|
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_mac")
|
||||||
set(OPENCV_ICV_NAME "ippicv_2020_mac_intel64_20191018_general.tgz")
|
if(X86_64)
|
||||||
set(OPENCV_ICV_HASH "1c3d675c2a2395d094d523024896e01b")
|
set(OPENCV_ICV_NAME "ippicv_2019_mac_intel64_general_20180723.tgz")
|
||||||
|
set(OPENCV_ICV_HASH "fe6b2bb75ae0e3f19ad3ae1a31dfa4a2")
|
||||||
|
else()
|
||||||
|
set(OPENCV_ICV_NAME "ippicv_2019_mac_ia32_general_20180723.tgz")
|
||||||
|
set(OPENCV_ICV_HASH "b5dfa78c87eb75c64470cbe5ec876f4f")
|
||||||
|
endif()
|
||||||
elseif((UNIX AND NOT ANDROID) OR (UNIX AND ANDROID_ABI MATCHES "x86"))
|
elseif((UNIX AND NOT ANDROID) OR (UNIX AND ANDROID_ABI MATCHES "x86"))
|
||||||
set(OPENCV_ICV_PLATFORM "linux")
|
set(OPENCV_ICV_PLATFORM "linux")
|
||||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_lnx")
|
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_lnx")
|
||||||
if(X86_64)
|
if(X86_64)
|
||||||
set(OPENCV_ICV_NAME "ippicv_2020_lnx_intel64_20191018_general.tgz")
|
set(OPENCV_ICV_NAME "ippicv_2019_lnx_intel64_general_20180723.tgz")
|
||||||
set(OPENCV_ICV_HASH "7421de0095c7a39162ae13a6098782f9")
|
set(OPENCV_ICV_HASH "c0bd78adb4156bbf552c1dfe90599607")
|
||||||
else()
|
else()
|
||||||
set(OPENCV_ICV_NAME "ippicv_2020_lnx_ia32_20191018_general.tgz")
|
set(OPENCV_ICV_NAME "ippicv_2019_lnx_ia32_general_20180723.tgz")
|
||||||
set(OPENCV_ICV_HASH "ad189a940fb60eb71f291321322fe3e8")
|
set(OPENCV_ICV_HASH "4f38432c30bfd6423164b7a24bbc98a0")
|
||||||
endif()
|
endif()
|
||||||
elseif(WIN32 AND NOT ARM)
|
elseif(WIN32 AND NOT ARM)
|
||||||
set(OPENCV_ICV_PLATFORM "windows")
|
set(OPENCV_ICV_PLATFORM "windows")
|
||||||
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_win")
|
set(OPENCV_ICV_PACKAGE_SUBDIR "ippicv_win")
|
||||||
if(X86_64)
|
if(X86_64)
|
||||||
set(OPENCV_ICV_NAME "ippicv_2020_win_intel64_20191018_general.zip")
|
set(OPENCV_ICV_NAME "ippicv_2019_win_intel64_20180723_general.zip")
|
||||||
set(OPENCV_ICV_HASH "879741a7946b814455eee6c6ffde2984")
|
set(OPENCV_ICV_HASH "1d222685246896fe089f88b8858e4b2f")
|
||||||
else()
|
else()
|
||||||
set(OPENCV_ICV_NAME "ippicv_2020_win_ia32_20191018_general.zip")
|
set(OPENCV_ICV_NAME "ippicv_2019_win_ia32_20180723_general.zip")
|
||||||
set(OPENCV_ICV_HASH "cd39bdf0c2e1cac9a61101dad7a2413e")
|
set(OPENCV_ICV_HASH "0157251a2eb9cd63a3ebc7eed0f3e59e")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
return()
|
return()
|
||||||
|
|||||||
+1
-7
@@ -196,10 +196,6 @@
|
|||||||
# define ITT_ARCH_PPC64 5
|
# define ITT_ARCH_PPC64 5
|
||||||
#endif /* ITT_ARCH_PPC64 */
|
#endif /* ITT_ARCH_PPC64 */
|
||||||
|
|
||||||
#ifndef ITT_ARCH_AARCH64 /* 64-bit ARM */
|
|
||||||
# define ITT_ARCH_AARCH64 6
|
|
||||||
#endif /* ITT_ARCH_AARCH64 */
|
|
||||||
|
|
||||||
#ifndef ITT_ARCH
|
#ifndef ITT_ARCH
|
||||||
# if defined _M_IX86 || defined __i386__
|
# if defined _M_IX86 || defined __i386__
|
||||||
# define ITT_ARCH ITT_ARCH_IA32
|
# define ITT_ARCH ITT_ARCH_IA32
|
||||||
@@ -209,8 +205,6 @@
|
|||||||
# define ITT_ARCH ITT_ARCH_IA64
|
# define ITT_ARCH ITT_ARCH_IA64
|
||||||
# elif defined _M_ARM || defined __arm__
|
# elif defined _M_ARM || defined __arm__
|
||||||
# define ITT_ARCH ITT_ARCH_ARM
|
# define ITT_ARCH ITT_ARCH_ARM
|
||||||
# elif defined __aarch64__
|
|
||||||
# define ITT_ARCH ITT_ARCH_AARCH64
|
|
||||||
# elif defined __powerpc64__
|
# elif defined __powerpc64__
|
||||||
# define ITT_ARCH ITT_ARCH_PPC64
|
# define ITT_ARCH ITT_ARCH_PPC64
|
||||||
# endif
|
# endif
|
||||||
@@ -365,7 +359,7 @@ ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
|
|||||||
: "memory");
|
: "memory");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_AARCH64 || ITT_ARCH==ITT_ARCH_PPC64
|
#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
|
||||||
#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
|
#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
|
||||||
#endif /* ITT_ARCH==ITT_ARCH_IA64 */
|
#endif /* ITT_ARCH==ITT_ARCH_IA64 */
|
||||||
#ifndef ITT_SIMPLE_INIT
|
#ifndef ITT_SIMPLE_INIT
|
||||||
|
|||||||
-6
@@ -17,12 +17,6 @@
|
|||||||
#if !defined(JAS_WIN_MSVC_BUILD)
|
#if !defined(JAS_WIN_MSVC_BUILD)
|
||||||
/* A configure-based build is being used. */
|
/* A configure-based build is being used. */
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
// uClibc-ng workaround: https://github.com/opencv/opencv/pull/15279
|
|
||||||
#ifndef L_tmpnam
|
|
||||||
#define L_tmpnam 20
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Extra debugging support */
|
/* Extra debugging support */
|
||||||
|
|||||||
+4
-5
@@ -4,9 +4,9 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter -Wsign-compare -Wshorten-6
|
|||||||
|
|
||||||
set(VERSION_MAJOR 2)
|
set(VERSION_MAJOR 2)
|
||||||
set(VERSION_MINOR 0)
|
set(VERSION_MINOR 0)
|
||||||
set(VERSION_REVISION 4)
|
set(VERSION_REVISION 2)
|
||||||
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
|
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
|
||||||
set(LIBJPEG_TURBO_VERSION_NUMBER 2000004)
|
set(LIBJPEG_TURBO_VERSION_NUMBER 2000002)
|
||||||
|
|
||||||
string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo")
|
string(TIMESTAMP BUILD "opencv-${OPENCV_VERSION}-libjpeg-turbo")
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
@@ -78,11 +78,10 @@ configure_file(jconfigint.h.in jconfigint.h)
|
|||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
set(JPEG_SOURCES
|
set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
|
||||||
jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c jcicc.c
|
|
||||||
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
|
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c jcphuff.c
|
||||||
jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
|
jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
|
||||||
jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c jdmainct.c jdmarker.c
|
jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c
|
||||||
jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
|
jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c jerror.c
|
||||||
jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
|
jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c
|
||||||
jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
||||||
|
|||||||
Vendored
+26
-36
@@ -1,14 +1,14 @@
|
|||||||
Background
|
Background
|
||||||
==========
|
==========
|
||||||
|
|
||||||
libjpeg-turbo is a JPEG image codec that uses SIMD instructions to accelerate
|
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
|
||||||
baseline JPEG compression and decompression on x86, x86-64, ARM, PowerPC, and
|
AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
|
||||||
MIPS systems, as well as progressive JPEG compression on x86 and x86-64
|
on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG
|
||||||
systems. On such systems, libjpeg-turbo is generally 2-6x as fast as libjpeg,
|
compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is
|
||||||
all else being equal. On other types of systems, libjpeg-turbo can still
|
generally 2-6x as fast as libjpeg, all else being equal. On other types of
|
||||||
outperform libjpeg by a significant amount, by virtue of its highly-optimized
|
systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
|
||||||
Huffman coding routines. In many cases, the performance of libjpeg-turbo
|
virtue of its highly-optimized Huffman coding routines. In many cases, the
|
||||||
rivals that of proprietary high-speed JPEG codecs.
|
performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.
|
||||||
|
|
||||||
libjpeg-turbo implements both the traditional libjpeg API as well as the less
|
libjpeg-turbo implements both the traditional libjpeg API as well as the less
|
||||||
powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
|
powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
|
||||||
@@ -135,24 +135,25 @@ without recompiling. libjpeg-turbo does not claim to support all of the
|
|||||||
libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
|
libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
|
||||||
cases (see below.)
|
cases (see below.)
|
||||||
|
|
||||||
By passing an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you
|
By passing an argument of `--with-jpeg7` or `--with-jpeg8` to `configure`, or
|
||||||
can build a version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so
|
an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you can build a
|
||||||
that programs that are built against libjpeg v7 or v8 can be run with
|
version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that
|
||||||
libjpeg-turbo. The following section describes which libjpeg v7+ features are
|
programs that are built against libjpeg v7 or v8 can be run with libjpeg-turbo.
|
||||||
supported and which aren't.
|
The following section describes which libjpeg v7+ features are supported and
|
||||||
|
which aren't.
|
||||||
|
|
||||||
### Support for libjpeg v7 and v8 Features
|
### Support for libjpeg v7 and v8 Features
|
||||||
|
|
||||||
#### Fully supported
|
#### Fully supported
|
||||||
|
|
||||||
- **libjpeg API: IDCT scaling extensions in decompressor**<br>
|
- **libjpeg: IDCT scaling extensions in decompressor**<br>
|
||||||
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
|
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
|
||||||
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
|
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
|
||||||
and 1/2 are SIMD-accelerated.)
|
and 1/2 are SIMD-accelerated.)
|
||||||
|
|
||||||
- **libjpeg API: Arithmetic coding**
|
- **libjpeg: Arithmetic coding**
|
||||||
|
|
||||||
- **libjpeg API: In-memory source and destination managers**<br>
|
- **libjpeg: In-memory source and destination managers**<br>
|
||||||
See notes below.
|
See notes below.
|
||||||
|
|
||||||
- **cjpeg: Separate quality settings for luminance and chrominance**<br>
|
- **cjpeg: Separate quality settings for luminance and chrominance**<br>
|
||||||
@@ -184,14 +185,14 @@ means of quality improvement. The reader is invited to peruse the research at
|
|||||||
but it is the general belief of our project that these features have not
|
but it is the general belief of our project that these features have not
|
||||||
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
||||||
|
|
||||||
- **libjpeg API: DCT scaling in compressor**<br>
|
- **libjpeg: DCT scaling in compressor**<br>
|
||||||
`cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
|
`cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
|
||||||
There is no technical reason why DCT scaling could not be supported when
|
There is no technical reason why DCT scaling could not be supported when
|
||||||
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
|
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
|
||||||
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
|
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
|
||||||
8/9 would be available, which is of limited usefulness.
|
8/9 would be available, which is of limited usefulness.
|
||||||
|
|
||||||
- **libjpeg API: SmartScale**<br>
|
- **libjpeg: SmartScale**<br>
|
||||||
`cinfo.block_size` is silently ignored.
|
`cinfo.block_size` is silently ignored.
|
||||||
SmartScale is an extension to the JPEG format that allows for DCT block
|
SmartScale is an extension to the JPEG format that allows for DCT block
|
||||||
sizes other than 8x8. Providing support for this new format would be
|
sizes other than 8x8. Providing support for this new format would be
|
||||||
@@ -204,7 +205,7 @@ demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
|||||||
interest in providing this feature would be as a means of supporting
|
interest in providing this feature would be as a means of supporting
|
||||||
additional DCT scaling factors.
|
additional DCT scaling factors.
|
||||||
|
|
||||||
- **libjpeg API: Fancy downsampling in compressor**<br>
|
- **libjpeg: Fancy downsampling in compressor**<br>
|
||||||
`cinfo.do_fancy_downsampling` is silently ignored.
|
`cinfo.do_fancy_downsampling` is silently ignored.
|
||||||
This requires the DCT scaling feature, which is not supported.
|
This requires the DCT scaling feature, which is not supported.
|
||||||
|
|
||||||
@@ -246,14 +247,15 @@ don't, and it allows those functions to be provided in the "official"
|
|||||||
libjpeg-turbo binaries.
|
libjpeg-turbo binaries.
|
||||||
|
|
||||||
Those who are concerned about maintaining strict conformance with the libjpeg
|
Those who are concerned about maintaining strict conformance with the libjpeg
|
||||||
v6b or v7 API can pass an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to
|
v6b or v7 API can pass an argument of `--without-mem-srcdst` to `configure` or
|
||||||
building libjpeg-turbo. This will restore the pre-1.3 behavior, in which
|
an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to building
|
||||||
|
libjpeg-turbo. This will restore the pre-1.3 behavior, in which
|
||||||
`jpeg_mem_src()` and `jpeg_mem_dest()` are only included when emulating the
|
`jpeg_mem_src()` and `jpeg_mem_dest()` are only included when emulating the
|
||||||
libjpeg v8 API/ABI.
|
libjpeg v8 API/ABI.
|
||||||
|
|
||||||
On Un*x systems, including the in-memory source/destination managers changes
|
On Un*x systems, including the in-memory source/destination managers changes
|
||||||
the dynamic library version from 62.2.0 to 62.3.0 if using libjpeg v6b API/ABI
|
the dynamic library version from 62.1.0 to 62.2.0 if using libjpeg v6b API/ABI
|
||||||
emulation and from 7.2.0 to 7.3.0 if using libjpeg v7 API/ABI emulation.
|
emulation and from 7.1.0 to 7.2.0 if using libjpeg v7 API/ABI emulation.
|
||||||
|
|
||||||
Note that, on most Un*x systems, the dynamic linker will not look for a
|
Note that, on most Un*x systems, the dynamic linker will not look for a
|
||||||
function in a library until that function is actually used. Thus, if a program
|
function in a library until that function is actually used. Thus, if a program
|
||||||
@@ -329,7 +331,7 @@ in a way that makes the rest of the libjpeg infrastructure happy, so it is
|
|||||||
necessary to use the slow Huffman decoder when decompressing a JPEG image that
|
necessary to use the slow Huffman decoder when decompressing a JPEG image that
|
||||||
has restart markers. This can cause the decompression performance to drop by
|
has restart markers. This can cause the decompression performance to drop by
|
||||||
as much as 20%, but the performance will still be much greater than that of
|
as much as 20%, but the performance will still be much greater than that of
|
||||||
libjpeg. Many consumer packages, such as Photoshop, use restart markers when
|
libjpeg. Many consumer packages, such as PhotoShop, use restart markers when
|
||||||
generating JPEG images, so images generated by those programs will experience
|
generating JPEG images, so images generated by those programs will experience
|
||||||
this issue.
|
this issue.
|
||||||
|
|
||||||
@@ -342,15 +344,3 @@ 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%.
|
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 slow integer forward DCT
|
||||||
whenever encoding images with a JPEG quality of 98 or higher.
|
whenever encoding images with a JPEG quality of 98 or higher.
|
||||||
|
|
||||||
|
|
||||||
Memory Debugger Pitfalls
|
|
||||||
========================
|
|
||||||
|
|
||||||
Valgrind and Memory Sanitizer (MSan) can generate false positives
|
|
||||||
(specifically, incorrect reports of uninitialized memory accesses) when used
|
|
||||||
with libjpeg-turbo's SIMD extensions. It is generally recommended that the
|
|
||||||
SIMD extensions be disabled, either by passing an argument of `-DWITH_SIMD=0`
|
|
||||||
to `cmake` when configuring the build or by setting the environment variable
|
|
||||||
`JSIMD_FORCENONE` to `1` at run time, when testing libjpeg-turbo with Valgrind,
|
|
||||||
MSan, or other memory debuggers.
|
|
||||||
|
|||||||
Vendored
+4
-8
@@ -4,7 +4,7 @@
|
|||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2009-2011, 2014-2016, 2018-2019, D. R. Commander.
|
* Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
|
||||||
* Copyright (C) 2015, Matthieu Darbois.
|
* Copyright (C) 2015, Matthieu Darbois.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
@@ -43,8 +43,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||||
#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
|
||||||
#if !defined(__thumb__) || defined(__thumb2__)
|
#if !defined __thumb__ || defined __thumb2__
|
||||||
#define USE_CLZ_INTRINSIC
|
#define USE_CLZ_INTRINSIC
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -356,8 +356,6 @@ dump_buffer(working_state *state)
|
|||||||
put_buffer = (put_buffer << size) | code; \
|
put_buffer = (put_buffer << size) | code; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SIZEOF_SIZE_T != 8 && !defined(_WIN64)
|
|
||||||
|
|
||||||
#define CHECKBUF15() { \
|
#define CHECKBUF15() { \
|
||||||
if (put_bits > 15) { \
|
if (put_bits > 15) { \
|
||||||
EMIT_BYTE() \
|
EMIT_BYTE() \
|
||||||
@@ -365,8 +363,6 @@ dump_buffer(working_state *state)
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CHECKBUF31() { \
|
#define CHECKBUF31() { \
|
||||||
if (put_bits > 31) { \
|
if (put_bits > 31) { \
|
||||||
EMIT_BYTE() \
|
EMIT_BYTE() \
|
||||||
@@ -432,7 +428,7 @@ dump_buffer(working_state *state)
|
|||||||
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
|
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
|
||||||
* larger than 200 bytes.
|
* larger than 200 bytes.
|
||||||
*/
|
*/
|
||||||
#define BUFSIZE (DCTSIZE2 * 8)
|
#define BUFSIZE (DCTSIZE2 * 4)
|
||||||
|
|
||||||
#define LOAD_BUFFER() { \
|
#define LOAD_BUFFER() { \
|
||||||
if (state->free_in_buffer < BUFSIZE) { \
|
if (state->free_in_buffer < BUFSIZE) { \
|
||||||
|
|||||||
Vendored
-105
@@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* jcicc.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 1997-1998, Thomas G. Lane, Todd Newman.
|
|
||||||
* Copyright (C) 2017, D. R. Commander.
|
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
|
||||||
* file.
|
|
||||||
*
|
|
||||||
* This file provides code to write International Color Consortium (ICC) device
|
|
||||||
* profiles embedded in JFIF JPEG image files. The ICC has defined a standard
|
|
||||||
* for including such data in JPEG "APP2" markers. The code given here does
|
|
||||||
* not know anything about the internal structure of the ICC profile data; it
|
|
||||||
* just knows how to embed the profile data in a JPEG file while writing it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define JPEG_INTERNALS
|
|
||||||
#include "jinclude.h"
|
|
||||||
#include "jpeglib.h"
|
|
||||||
#include "jerror.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Since an ICC profile can be larger than the maximum size of a JPEG marker
|
|
||||||
* (64K), we need provisions to split it into multiple markers. The format
|
|
||||||
* defined by the ICC specifies one or more APP2 markers containing the
|
|
||||||
* following data:
|
|
||||||
* Identifying string ASCII "ICC_PROFILE\0" (12 bytes)
|
|
||||||
* Marker sequence number 1 for first APP2, 2 for next, etc (1 byte)
|
|
||||||
* Number of markers Total number of APP2's used (1 byte)
|
|
||||||
* Profile data (remainder of APP2 data)
|
|
||||||
* Decoders should use the marker sequence numbers to reassemble the profile,
|
|
||||||
* rather than assuming that the APP2 markers appear in the correct sequence.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
|
|
||||||
#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
|
|
||||||
#define MAX_BYTES_IN_MARKER 65533 /* maximum data len of a JPEG marker */
|
|
||||||
#define MAX_DATA_BYTES_IN_MARKER (MAX_BYTES_IN_MARKER - ICC_OVERHEAD_LEN)
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This routine writes the given ICC profile data into a JPEG file. It *must*
|
|
||||||
* be called AFTER calling jpeg_start_compress() and BEFORE the first call to
|
|
||||||
* jpeg_write_scanlines(). (This ordering ensures that the APP2 marker(s) will
|
|
||||||
* appear after the SOI and JFIF or Adobe markers, but before all else.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
GLOBAL(void)
|
|
||||||
jpeg_write_icc_profile(j_compress_ptr cinfo, const JOCTET *icc_data_ptr,
|
|
||||||
unsigned int icc_data_len)
|
|
||||||
{
|
|
||||||
unsigned int num_markers; /* total number of markers we'll write */
|
|
||||||
int cur_marker = 1; /* per spec, counting starts at 1 */
|
|
||||||
unsigned int length; /* number of bytes to write in this marker */
|
|
||||||
|
|
||||||
if (icc_data_ptr == NULL || icc_data_len == 0)
|
|
||||||
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
|
||||||
if (cinfo->global_state < CSTATE_SCANNING)
|
|
||||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
|
||||||
|
|
||||||
/* Calculate the number of markers we'll need, rounding up of course */
|
|
||||||
num_markers = icc_data_len / MAX_DATA_BYTES_IN_MARKER;
|
|
||||||
if (num_markers * MAX_DATA_BYTES_IN_MARKER != icc_data_len)
|
|
||||||
num_markers++;
|
|
||||||
|
|
||||||
while (icc_data_len > 0) {
|
|
||||||
/* length of profile to put in this marker */
|
|
||||||
length = icc_data_len;
|
|
||||||
if (length > MAX_DATA_BYTES_IN_MARKER)
|
|
||||||
length = MAX_DATA_BYTES_IN_MARKER;
|
|
||||||
icc_data_len -= length;
|
|
||||||
|
|
||||||
/* Write the JPEG marker header (APP2 code and marker length) */
|
|
||||||
jpeg_write_m_header(cinfo, ICC_MARKER,
|
|
||||||
(unsigned int)(length + ICC_OVERHEAD_LEN));
|
|
||||||
|
|
||||||
/* Write the marker identifying string "ICC_PROFILE" (null-terminated). We
|
|
||||||
* code it in this less-than-transparent way so that the code works even if
|
|
||||||
* the local character set is not ASCII.
|
|
||||||
*/
|
|
||||||
jpeg_write_m_byte(cinfo, 0x49);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x43);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x43);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x5F);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x50);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x52);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x4F);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x46);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x49);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x4C);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x45);
|
|
||||||
jpeg_write_m_byte(cinfo, 0x0);
|
|
||||||
|
|
||||||
/* Add the sequencing info */
|
|
||||||
jpeg_write_m_byte(cinfo, cur_marker);
|
|
||||||
jpeg_write_m_byte(cinfo, (int)num_markers);
|
|
||||||
|
|
||||||
/* Add the profile data */
|
|
||||||
while (length--) {
|
|
||||||
jpeg_write_m_byte(cinfo, *icc_data_ptr);
|
|
||||||
icc_data_ptr++;
|
|
||||||
}
|
|
||||||
cur_marker++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -492,8 +492,8 @@ prepare_for_pass(j_compress_ptr cinfo)
|
|||||||
*/
|
*/
|
||||||
master->pass_type = output_pass;
|
master->pass_type = output_pass;
|
||||||
master->pass_number++;
|
master->pass_number++;
|
||||||
#endif
|
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
|
#endif
|
||||||
case output_pass:
|
case output_pass:
|
||||||
/* Do a data-output pass. */
|
/* Do a data-output pass. */
|
||||||
/* We need not repeat per-scan setup if prior optimization pass did it. */
|
/* We need not repeat per-scan setup if prior optimization pass did it. */
|
||||||
|
|||||||
Vendored
+2
-2
@@ -52,8 +52,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* NOTE: Both GCC and Clang define __GNUC__ */
|
/* NOTE: Both GCC and Clang define __GNUC__ */
|
||||||
#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
|
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
|
||||||
#if !defined(__thumb__) || defined(__thumb2__)
|
#if !defined __thumb__ || defined __thumb2__
|
||||||
#define USE_CLZ_INTRINSIC
|
#define USE_CLZ_INTRINSIC
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Vendored
+3
-7
@@ -4,7 +4,7 @@
|
|||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software:
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2009-2011, 2016, 2018-2019, D. R. Commander.
|
* Copyright (C) 2009-2011, 2016, 2018, D. R. Commander.
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
@@ -589,11 +589,7 @@ decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
if (entropy->dc_needed[blkn]) {
|
if (entropy->dc_needed[blkn]) {
|
||||||
/* Convert DC difference to actual value, update last_dc_val */
|
/* Convert DC difference to actual value, update last_dc_val */
|
||||||
int ci = cinfo->MCU_membership[blkn];
|
int ci = cinfo->MCU_membership[blkn];
|
||||||
/* This is really just
|
s += state.last_dc_val[ci];
|
||||||
* s += state.last_dc_val[ci];
|
|
||||||
* It is written this way in order to shut up UBSan.
|
|
||||||
*/
|
|
||||||
s = (int)((unsigned int)s + (unsigned int)state.last_dc_val[ci]);
|
|
||||||
state.last_dc_val[ci] = s;
|
state.last_dc_val[ci] = s;
|
||||||
if (block) {
|
if (block) {
|
||||||
/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
|
/* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
|
||||||
@@ -688,7 +684,7 @@ decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
|
|
||||||
if (entropy->dc_needed[blkn]) {
|
if (entropy->dc_needed[blkn]) {
|
||||||
int ci = cinfo->MCU_membership[blkn];
|
int ci = cinfo->MCU_membership[blkn];
|
||||||
s = (int)((unsigned int)s + (unsigned int)state.last_dc_val[ci]);
|
s += state.last_dc_val[ci];
|
||||||
state.last_dc_val[ci] = s;
|
state.last_dc_val[ci] = s;
|
||||||
if (block)
|
if (block)
|
||||||
(*block)[0] = (JCOEF)s;
|
(*block)[0] = (JCOEF)s;
|
||||||
|
|||||||
Vendored
-171
@@ -1,171 +0,0 @@
|
|||||||
/*
|
|
||||||
* jdicc.c
|
|
||||||
*
|
|
||||||
* Copyright (C) 1997-1998, Thomas G. Lane, Todd Newman.
|
|
||||||
* Copyright (C) 2017, D. R. Commander.
|
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
|
||||||
* file.
|
|
||||||
*
|
|
||||||
* This file provides code to read International Color Consortium (ICC) device
|
|
||||||
* profiles embedded in JFIF JPEG image files. The ICC has defined a standard
|
|
||||||
* for including such data in JPEG "APP2" markers. The code given here does
|
|
||||||
* not know anything about the internal structure of the ICC profile data; it
|
|
||||||
* just knows how to get the profile data from a JPEG file while reading it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define JPEG_INTERNALS
|
|
||||||
#include "jinclude.h"
|
|
||||||
#include "jpeglib.h"
|
|
||||||
#include "jerror.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc() */
|
|
||||||
extern void *malloc(size_t size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */
|
|
||||||
#define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handy subroutine to test whether a saved marker is an ICC profile marker.
|
|
||||||
*/
|
|
||||||
|
|
||||||
LOCAL(boolean)
|
|
||||||
marker_is_icc(jpeg_saved_marker_ptr marker)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
marker->marker == ICC_MARKER &&
|
|
||||||
marker->data_length >= ICC_OVERHEAD_LEN &&
|
|
||||||
/* verify the identifying string */
|
|
||||||
GETJOCTET(marker->data[0]) == 0x49 &&
|
|
||||||
GETJOCTET(marker->data[1]) == 0x43 &&
|
|
||||||
GETJOCTET(marker->data[2]) == 0x43 &&
|
|
||||||
GETJOCTET(marker->data[3]) == 0x5F &&
|
|
||||||
GETJOCTET(marker->data[4]) == 0x50 &&
|
|
||||||
GETJOCTET(marker->data[5]) == 0x52 &&
|
|
||||||
GETJOCTET(marker->data[6]) == 0x4F &&
|
|
||||||
GETJOCTET(marker->data[7]) == 0x46 &&
|
|
||||||
GETJOCTET(marker->data[8]) == 0x49 &&
|
|
||||||
GETJOCTET(marker->data[9]) == 0x4C &&
|
|
||||||
GETJOCTET(marker->data[10]) == 0x45 &&
|
|
||||||
GETJOCTET(marker->data[11]) == 0x0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* See if there was an ICC profile in the JPEG file being read; if so,
|
|
||||||
* reassemble and return the profile data.
|
|
||||||
*
|
|
||||||
* TRUE is returned if an ICC profile was found, FALSE if not. If TRUE is
|
|
||||||
* returned, *icc_data_ptr is set to point to the returned data, and
|
|
||||||
* *icc_data_len is set to its length.
|
|
||||||
*
|
|
||||||
* IMPORTANT: the data at *icc_data_ptr is allocated with malloc() and must be
|
|
||||||
* freed by the caller with free() when the caller no longer needs it.
|
|
||||||
* (Alternatively, we could write this routine to use the IJG library's memory
|
|
||||||
* allocator, so that the data would be freed implicitly when
|
|
||||||
* jpeg_finish_decompress() is called. But it seems likely that many
|
|
||||||
* applications will prefer to have the data stick around after decompression
|
|
||||||
* finishes.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
GLOBAL(boolean)
|
|
||||||
jpeg_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr,
|
|
||||||
unsigned int *icc_data_len)
|
|
||||||
{
|
|
||||||
jpeg_saved_marker_ptr marker;
|
|
||||||
int num_markers = 0;
|
|
||||||
int seq_no;
|
|
||||||
JOCTET *icc_data;
|
|
||||||
unsigned int total_length;
|
|
||||||
#define MAX_SEQ_NO 255 /* sufficient since marker numbers are bytes */
|
|
||||||
char marker_present[MAX_SEQ_NO + 1]; /* 1 if marker found */
|
|
||||||
unsigned int data_length[MAX_SEQ_NO + 1]; /* size of profile data in marker */
|
|
||||||
unsigned int data_offset[MAX_SEQ_NO + 1]; /* offset for data in marker */
|
|
||||||
|
|
||||||
if (icc_data_ptr == NULL || icc_data_len == NULL)
|
|
||||||
ERREXIT(cinfo, JERR_BUFFER_SIZE);
|
|
||||||
if (cinfo->global_state < DSTATE_READY)
|
|
||||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
|
||||||
|
|
||||||
*icc_data_ptr = NULL; /* avoid confusion if FALSE return */
|
|
||||||
*icc_data_len = 0;
|
|
||||||
|
|
||||||
/* This first pass over the saved markers discovers whether there are
|
|
||||||
* any ICC markers and verifies the consistency of the marker numbering.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (seq_no = 1; seq_no <= MAX_SEQ_NO; seq_no++)
|
|
||||||
marker_present[seq_no] = 0;
|
|
||||||
|
|
||||||
for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
|
|
||||||
if (marker_is_icc(marker)) {
|
|
||||||
if (num_markers == 0)
|
|
||||||
num_markers = GETJOCTET(marker->data[13]);
|
|
||||||
else if (num_markers != GETJOCTET(marker->data[13])) {
|
|
||||||
WARNMS(cinfo, JWRN_BOGUS_ICC); /* inconsistent num_markers fields */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
seq_no = GETJOCTET(marker->data[12]);
|
|
||||||
if (seq_no <= 0 || seq_no > num_markers) {
|
|
||||||
WARNMS(cinfo, JWRN_BOGUS_ICC); /* bogus sequence number */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (marker_present[seq_no]) {
|
|
||||||
WARNMS(cinfo, JWRN_BOGUS_ICC); /* duplicate sequence numbers */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
marker_present[seq_no] = 1;
|
|
||||||
data_length[seq_no] = marker->data_length - ICC_OVERHEAD_LEN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_markers == 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Check for missing markers, count total space needed,
|
|
||||||
* compute offset of each marker's part of the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
total_length = 0;
|
|
||||||
for (seq_no = 1; seq_no <= num_markers; seq_no++) {
|
|
||||||
if (marker_present[seq_no] == 0) {
|
|
||||||
WARNMS(cinfo, JWRN_BOGUS_ICC); /* missing sequence number */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
data_offset[seq_no] = total_length;
|
|
||||||
total_length += data_length[seq_no];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (total_length == 0) {
|
|
||||||
WARNMS(cinfo, JWRN_BOGUS_ICC); /* found only empty markers? */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate space for assembled data */
|
|
||||||
icc_data = (JOCTET *)malloc(total_length * sizeof(JOCTET));
|
|
||||||
if (icc_data == NULL)
|
|
||||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 11); /* oops, out of memory */
|
|
||||||
|
|
||||||
/* and fill it in */
|
|
||||||
for (marker = cinfo->marker_list; marker != NULL; marker = marker->next) {
|
|
||||||
if (marker_is_icc(marker)) {
|
|
||||||
JOCTET FAR *src_ptr;
|
|
||||||
JOCTET *dst_ptr;
|
|
||||||
unsigned int length;
|
|
||||||
seq_no = GETJOCTET(marker->data[12]);
|
|
||||||
dst_ptr = icc_data + data_offset[seq_no];
|
|
||||||
src_ptr = marker->data + ICC_OVERHEAD_LEN;
|
|
||||||
length = data_length[seq_no];
|
|
||||||
while (length--) {
|
|
||||||
*dst_ptr++ = *src_ptr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*icc_data_ptr = icc_data;
|
|
||||||
*icc_data_len = total_length;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
Vendored
+2
@@ -429,6 +429,8 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
|||||||
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
|
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
|
||||||
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
|
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
|
||||||
|
|
||||||
|
#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
|
||||||
|
|
||||||
#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
|
#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
|
||||||
((INT16 *)(addr))[0] = (INT16)(pixels); \
|
((INT16 *)(addr))[0] = (INT16)(pixels); \
|
||||||
((INT16 *)(addr))[1] = (INT16)((pixels) >> 16); \
|
((INT16 *)(addr))[1] = (INT16)((pixels) >> 16); \
|
||||||
|
|||||||
+5
-9
@@ -8,7 +8,6 @@
|
|||||||
* Copyright (C) 2010, 2015-2016, D. R. Commander.
|
* Copyright (C) 2010, 2015-2016, D. R. Commander.
|
||||||
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
* Copyright (C) 2014, MIPS Technologies, Inc., California.
|
||||||
* Copyright (C) 2015, Google, Inc.
|
* Copyright (C) 2015, Google, Inc.
|
||||||
* Copyright (C) 2019, Arm Limited.
|
|
||||||
* For conditions of distribution and use, see the accompanying README.ijg
|
* For conditions of distribution and use, see the accompanying README.ijg
|
||||||
* file.
|
* file.
|
||||||
*
|
*
|
||||||
@@ -316,9 +315,9 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
|||||||
JSAMPARRAY output_data = *output_data_ptr;
|
JSAMPARRAY output_data = *output_data_ptr;
|
||||||
JSAMPROW inptr0, inptr1, outptr;
|
JSAMPROW inptr0, inptr1, outptr;
|
||||||
#if BITS_IN_JSAMPLE == 8
|
#if BITS_IN_JSAMPLE == 8
|
||||||
int thiscolsum, bias;
|
int thiscolsum;
|
||||||
#else
|
#else
|
||||||
JLONG thiscolsum, bias;
|
JLONG thiscolsum;
|
||||||
#endif
|
#endif
|
||||||
JDIMENSION colctr;
|
JDIMENSION colctr;
|
||||||
int inrow, outrow, v;
|
int inrow, outrow, v;
|
||||||
@@ -328,18 +327,15 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
|
|||||||
for (v = 0; v < 2; v++) {
|
for (v = 0; v < 2; v++) {
|
||||||
/* inptr0 points to nearest input row, inptr1 points to next nearest */
|
/* inptr0 points to nearest input row, inptr1 points to next nearest */
|
||||||
inptr0 = input_data[inrow];
|
inptr0 = input_data[inrow];
|
||||||
if (v == 0) { /* next nearest is row above */
|
if (v == 0) /* next nearest is row above */
|
||||||
inptr1 = input_data[inrow - 1];
|
inptr1 = input_data[inrow - 1];
|
||||||
bias = 1;
|
else /* next nearest is row below */
|
||||||
} else { /* next nearest is row below */
|
|
||||||
inptr1 = input_data[inrow + 1];
|
inptr1 = input_data[inrow + 1];
|
||||||
bias = 2;
|
|
||||||
}
|
|
||||||
outptr = output_data[outrow++];
|
outptr = output_data[outrow++];
|
||||||
|
|
||||||
for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
|
for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
|
||||||
thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
|
thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
|
||||||
*outptr++ = (JSAMPLE)((thiscolsum + bias) >> 2);
|
*outptr++ = (JSAMPLE)((thiscolsum + 1) >> 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inrow++;
|
inrow++;
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* jfdctint.c
|
* jfdctint.c
|
||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software.
|
||||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2015, D. R. Commander.
|
* Copyright (C) 2015, D. R. Commander.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* jidctint.c
|
* jidctint.c
|
||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software.
|
||||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||||
* Modification developed 2002-2009 by Guido Vollbeding.
|
* Modification developed 2002-2009 by Guido Vollbeding.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* jidctred.c
|
* jidctred.c
|
||||||
*
|
*
|
||||||
* This file was part of the Independent JPEG Group's software:
|
* This file was part of the Independent JPEG Group's software.
|
||||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||||
* libjpeg-turbo Modifications:
|
* libjpeg-turbo Modifications:
|
||||||
* Copyright (C) 2015, D. R. Commander.
|
* Copyright (C) 2015, D. R. Commander.
|
||||||
|
|||||||
Vendored
+7
@@ -15,6 +15,13 @@ else()
|
|||||||
ocv_list_filterout(lib_srcs jmemnobs.c)
|
ocv_list_filterout(lib_srcs jmemnobs.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WINRT)
|
||||||
|
add_definitions(-DNO_GETENV)
|
||||||
|
get_directory_property( DirDefs COMPILE_DEFINITIONS )
|
||||||
|
message(STATUS "Adding NO_GETENV to compiler definitions for WINRT:")
|
||||||
|
message(STATUS " COMPILE_DEFINITIONS = ${DirDefs}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
# Define the library target:
|
# Define the library target:
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
|
|||||||
Vendored
+6
-9
@@ -1,7 +1,7 @@
|
|||||||
The Independent JPEG Group's JPEG software
|
The Independent JPEG Group's JPEG software
|
||||||
==========================================
|
==========================================
|
||||||
|
|
||||||
README for release 9c of 14-Jan-2018
|
README for release 9b of 17-Jan-2016
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
This distribution contains the ninth public release of the Independent JPEG
|
This distribution contains the ninth public release of the Independent JPEG
|
||||||
@@ -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,
|
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.
|
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-2016, Thomas G. Lane, Guido Vollbeding.
|
||||||
All Rights Reserved except as specified below.
|
All Rights Reserved except as specified below.
|
||||||
|
|
||||||
Permission is hereby granted to use, copy, modify, and distribute this
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
@@ -246,8 +246,8 @@ ARCHIVE LOCATIONS
|
|||||||
The "official" archive site for this software is www.ijg.org.
|
The "official" archive site for this software is www.ijg.org.
|
||||||
The most recent released version can always be found there in
|
The most recent released version can always be found there in
|
||||||
directory "files". This particular version will be archived as
|
directory "files". This particular version will be archived as
|
||||||
http://www.ijg.org/files/jpegsrc.v9c.tar.gz, and in Windows-compatible
|
http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible
|
||||||
"zip" archive format as http://www.ijg.org/files/jpegsr9c.zip.
|
"zip" archive format as http://www.ijg.org/files/jpegsr9b.zip.
|
||||||
|
|
||||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||||
general information about JPEG.
|
general information about JPEG.
|
||||||
@@ -293,11 +293,8 @@ communication about JPEG configuration in Sigma Photo Pro software.
|
|||||||
|
|
||||||
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
||||||
|
|
||||||
Thank to Thomas G. Lane for the original design and development of
|
Last but not least special thank to Thomas G. Lane for the original
|
||||||
this singular software package.
|
design and development of this singular software package.
|
||||||
|
|
||||||
Thank to Lars Goehler, Andreas Heinecke, Sebastian Fuss, Yvonne Roebert,
|
|
||||||
Andrej Werner, and Ulf-Dietrich Braumann for support and public relations.
|
|
||||||
|
|
||||||
|
|
||||||
FILE FORMAT WARS
|
FILE FORMAT WARS
|
||||||
|
|||||||
Vendored
-21
@@ -1,27 +1,6 @@
|
|||||||
CHANGE LOG for Independent JPEG Group's JPEG software
|
CHANGE LOG for Independent JPEG Group's JPEG software
|
||||||
|
|
||||||
|
|
||||||
Version 9c 14-Jan-2018
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
jpegtran: add an option to the -wipe switch to fill the region
|
|
||||||
with the average of adjacent blocks, instead of gray out.
|
|
||||||
Thank to Caitlyn Feddock and Maddie Ziegler for inspiration.
|
|
||||||
|
|
||||||
Make range extension bits adjustable (in jpegint.h).
|
|
||||||
Thank to Robin Watts for suggestion.
|
|
||||||
|
|
||||||
Provide macros for fflush() and ferror() in jinclude.h in order
|
|
||||||
to facilitate adaption by applications using an own FILE class.
|
|
||||||
Thank to Gerhard Huber for suggestion.
|
|
||||||
|
|
||||||
Add libjpeg pkg-config file. Thank to Mark Lavi, Vincent Torri,
|
|
||||||
Patrick McMunn, and Huw Davies for suggestion.
|
|
||||||
|
|
||||||
Add sanity checks in cjpeg image reader modules.
|
|
||||||
Thank to Bingchang, Liu for reports.
|
|
||||||
|
|
||||||
|
|
||||||
Version 9b 17-Jan-2016
|
Version 9b 17-Jan-2016
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-167
@@ -2,7 +2,7 @@
|
|||||||
* jcinit.c
|
* jcinit.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2003-2017 by Guido Vollbeding.
|
* Modified 2003-2013 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -21,168 +21,6 @@
|
|||||||
#include "jpeglib.h"
|
#include "jpeglib.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Compute JPEG image dimensions and related values.
|
|
||||||
* NOTE: this is exported for possible use by application.
|
|
||||||
* Hence it mustn't do anything that can't be done twice.
|
|
||||||
*/
|
|
||||||
|
|
||||||
GLOBAL(void)
|
|
||||||
jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
|
|
||||||
/* Do computations that are needed before master selection phase */
|
|
||||||
{
|
|
||||||
/* Sanity check on input image dimensions to prevent overflow in
|
|
||||||
* following calculations.
|
|
||||||
* We do check jpeg_width and jpeg_height in initial_setup in jcmaster.c,
|
|
||||||
* but image_width and image_height can come from arbitrary data,
|
|
||||||
* and we need some space for multiplication by block_size.
|
|
||||||
*/
|
|
||||||
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
|
|
||||||
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
|
||||||
|
|
||||||
#ifdef DCT_SCALING_SUPPORTED
|
|
||||||
|
|
||||||
/* Compute actual JPEG image dimensions and DCT scaling choices. */
|
|
||||||
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/1 scaling */
|
|
||||||
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
|
|
||||||
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
|
|
||||||
cinfo->min_DCT_h_scaled_size = 1;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 1;
|
|
||||||
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/2 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 2;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 2;
|
|
||||||
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/3 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 3;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 3;
|
|
||||||
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/4 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 4;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 4;
|
|
||||||
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/5 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 5;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 5;
|
|
||||||
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/6 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 6;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 6;
|
|
||||||
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/7 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 7;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 7;
|
|
||||||
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/8 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 8;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 8;
|
|
||||||
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/9 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 9;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 9;
|
|
||||||
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/10 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 10;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 10;
|
|
||||||
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/11 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 11;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 11;
|
|
||||||
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/12 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 12;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 12;
|
|
||||||
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/13 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 13;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 13;
|
|
||||||
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/14 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 14;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 14;
|
|
||||||
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
|
|
||||||
/* Provide block_size/15 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 15;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 15;
|
|
||||||
} else {
|
|
||||||
/* Provide block_size/16 scaling */
|
|
||||||
cinfo->jpeg_width = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
|
|
||||||
cinfo->jpeg_height = (JDIMENSION)
|
|
||||||
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
|
|
||||||
cinfo->min_DCT_h_scaled_size = 16;
|
|
||||||
cinfo->min_DCT_v_scaled_size = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* !DCT_SCALING_SUPPORTED */
|
|
||||||
|
|
||||||
/* Hardwire it to "no scaling" */
|
|
||||||
cinfo->jpeg_width = cinfo->image_width;
|
|
||||||
cinfo->jpeg_height = cinfo->image_height;
|
|
||||||
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
|
||||||
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
|
||||||
|
|
||||||
#endif /* DCT_SCALING_SUPPORTED */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Master selection of compression modules.
|
* Master selection of compression modules.
|
||||||
* This is done once at the start of processing an image. We determine
|
* This is done once at the start of processing an image. We determine
|
||||||
@@ -199,7 +37,7 @@ jinit_compress_master (j_compress_ptr cinfo)
|
|||||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||||
|
|
||||||
/* Sanity check on input image dimensions */
|
/* Sanity check on image dimensions */
|
||||||
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|
||||||
cinfo->input_components <= 0)
|
cinfo->input_components <= 0)
|
||||||
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
||||||
@@ -210,9 +48,6 @@ jinit_compress_master (j_compress_ptr cinfo)
|
|||||||
if ((long) jd_samplesperrow != samplesperrow)
|
if ((long) jd_samplesperrow != samplesperrow)
|
||||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||||
|
|
||||||
/* Compute JPEG image dimensions and related values. */
|
|
||||||
jpeg_calc_jpeg_dimensions(cinfo);
|
|
||||||
|
|
||||||
/* Initialize master control (includes parameter checking/processing) */
|
/* Initialize master control (includes parameter checking/processing) */
|
||||||
jinit_c_master_control(cinfo, FALSE /* full compression */);
|
jinit_c_master_control(cinfo, FALSE /* full compression */);
|
||||||
|
|
||||||
|
|||||||
Vendored
+187
-5
@@ -2,7 +2,7 @@
|
|||||||
* jcmaster.c
|
* jcmaster.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2003-2017 by Guido Vollbeding.
|
* Modified 2003-2013 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -43,13 +43,191 @@ typedef my_comp_master * my_master_ptr;
|
|||||||
* Support routines that do various essential calculations.
|
* Support routines that do various essential calculations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute JPEG image dimensions and related values.
|
||||||
|
* NOTE: this is exported for possible use by application.
|
||||||
|
* Hence it mustn't do anything that can't be done twice.
|
||||||
|
*/
|
||||||
|
|
||||||
|
GLOBAL(void)
|
||||||
|
jpeg_calc_jpeg_dimensions (j_compress_ptr cinfo)
|
||||||
|
/* Do computations that are needed before master selection phase */
|
||||||
|
{
|
||||||
|
#ifdef DCT_SCALING_SUPPORTED
|
||||||
|
|
||||||
|
/* Sanity check on input image dimensions to prevent overflow in
|
||||||
|
* following calculation.
|
||||||
|
* We do check jpeg_width and jpeg_height in initial_setup below,
|
||||||
|
* but image_width and image_height can come from arbitrary data,
|
||||||
|
* and we need some space for multiplication by block_size.
|
||||||
|
*/
|
||||||
|
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
|
||||||
|
ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
|
||||||
|
|
||||||
|
/* Compute actual JPEG image dimensions and DCT scaling choices. */
|
||||||
|
if (cinfo->scale_num >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/1 scaling */
|
||||||
|
cinfo->jpeg_width = cinfo->image_width * cinfo->block_size;
|
||||||
|
cinfo->jpeg_height = cinfo->image_height * cinfo->block_size;
|
||||||
|
cinfo->min_DCT_h_scaled_size = 1;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 1;
|
||||||
|
} else if (cinfo->scale_num * 2 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/2 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 2L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 2L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 2;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 2;
|
||||||
|
} else if (cinfo->scale_num * 3 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/3 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 3L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 3L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 3;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 3;
|
||||||
|
} else if (cinfo->scale_num * 4 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/4 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 4L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 4L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 4;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 4;
|
||||||
|
} else if (cinfo->scale_num * 5 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/5 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 5L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 5L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 5;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 5;
|
||||||
|
} else if (cinfo->scale_num * 6 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/6 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 6L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 6L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 6;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 6;
|
||||||
|
} else if (cinfo->scale_num * 7 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/7 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 7L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 7L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 7;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 7;
|
||||||
|
} else if (cinfo->scale_num * 8 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/8 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 8L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 8L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 8;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 8;
|
||||||
|
} else if (cinfo->scale_num * 9 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/9 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 9L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 9L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 9;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 9;
|
||||||
|
} else if (cinfo->scale_num * 10 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/10 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 10L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 10L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 10;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 10;
|
||||||
|
} else if (cinfo->scale_num * 11 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/11 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 11L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 11L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 11;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 11;
|
||||||
|
} else if (cinfo->scale_num * 12 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/12 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 12L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 12L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 12;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 12;
|
||||||
|
} else if (cinfo->scale_num * 13 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/13 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 13L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 13L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 13;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 13;
|
||||||
|
} else if (cinfo->scale_num * 14 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/14 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 14L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 14L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 14;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 14;
|
||||||
|
} else if (cinfo->scale_num * 15 >= cinfo->scale_denom * cinfo->block_size) {
|
||||||
|
/* Provide block_size/15 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 15L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 15L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 15;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 15;
|
||||||
|
} else {
|
||||||
|
/* Provide block_size/16 scaling */
|
||||||
|
cinfo->jpeg_width = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_width * cinfo->block_size, 16L);
|
||||||
|
cinfo->jpeg_height = (JDIMENSION)
|
||||||
|
jdiv_round_up((long) cinfo->image_height * cinfo->block_size, 16L);
|
||||||
|
cinfo->min_DCT_h_scaled_size = 16;
|
||||||
|
cinfo->min_DCT_v_scaled_size = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !DCT_SCALING_SUPPORTED */
|
||||||
|
|
||||||
|
/* Hardwire it to "no scaling" */
|
||||||
|
cinfo->jpeg_width = cinfo->image_width;
|
||||||
|
cinfo->jpeg_height = cinfo->image_height;
|
||||||
|
cinfo->min_DCT_h_scaled_size = DCTSIZE;
|
||||||
|
cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
||||||
|
|
||||||
|
#endif /* DCT_SCALING_SUPPORTED */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
initial_setup (j_compress_ptr cinfo)
|
jpeg_calc_trans_dimensions (j_compress_ptr cinfo)
|
||||||
|
{
|
||||||
|
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
|
||||||
|
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
|
||||||
|
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
|
||||||
|
|
||||||
|
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LOCAL(void)
|
||||||
|
initial_setup (j_compress_ptr cinfo, boolean transcode_only)
|
||||||
/* Do computations that are needed before master selection phase */
|
/* Do computations that are needed before master selection phase */
|
||||||
{
|
{
|
||||||
int ci, ssize;
|
int ci, ssize;
|
||||||
jpeg_component_info *compptr;
|
jpeg_component_info *compptr;
|
||||||
|
|
||||||
|
if (transcode_only)
|
||||||
|
jpeg_calc_trans_dimensions(cinfo);
|
||||||
|
else
|
||||||
|
jpeg_calc_jpeg_dimensions(cinfo);
|
||||||
|
|
||||||
/* Sanity check on block_size */
|
/* Sanity check on block_size */
|
||||||
if (cinfo->block_size < 1 || cinfo->block_size > 16)
|
if (cinfo->block_size < 1 || cinfo->block_size > 16)
|
||||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
|
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
|
||||||
@@ -236,9 +414,13 @@ validate_script (j_compress_ptr cinfo)
|
|||||||
* out-of-range reconstructed DC values during the first DC scan,
|
* out-of-range reconstructed DC values during the first DC scan,
|
||||||
* which might cause problems for some decoders.
|
* which might cause problems for some decoders.
|
||||||
*/
|
*/
|
||||||
|
#if BITS_IN_JSAMPLE == 8
|
||||||
|
#define MAX_AH_AL 10
|
||||||
|
#else
|
||||||
|
#define MAX_AH_AL 13
|
||||||
|
#endif
|
||||||
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
|
if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
|
||||||
Ah < 0 || Ah > (cinfo->data_precision > 8 ? 13 : 10) ||
|
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
|
||||||
Al < 0 || Al > (cinfo->data_precision > 8 ? 13 : 10))
|
|
||||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||||
if (Ss == 0) {
|
if (Ss == 0) {
|
||||||
if (Se != 0) /* DC and AC together not OK */
|
if (Se != 0) /* DC and AC together not OK */
|
||||||
@@ -630,7 +812,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
|||||||
master->pub.is_last_pass = FALSE;
|
master->pub.is_last_pass = FALSE;
|
||||||
|
|
||||||
/* Validate parameters, determine derived values */
|
/* Validate parameters, determine derived values */
|
||||||
initial_setup(cinfo);
|
initial_setup(cinfo, transcode_only);
|
||||||
|
|
||||||
if (cinfo->scan_info != NULL) {
|
if (cinfo->scan_info != NULL) {
|
||||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||||
|
|||||||
Vendored
+3
-21
@@ -2,7 +2,7 @@
|
|||||||
* jctrans.c
|
* jctrans.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995-1998, Thomas G. Lane.
|
* Copyright (C) 1995-1998, Thomas G. Lane.
|
||||||
* Modified 2000-2017 by Guido Vollbeding.
|
* Modified 2000-2013 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -85,15 +85,12 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
jpeg_set_defaults(dstinfo);
|
jpeg_set_defaults(dstinfo);
|
||||||
/* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
|
/* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
|
||||||
* Fix it to get the right header markers for the image colorspace.
|
* Fix it to get the right header markers for the image colorspace.
|
||||||
* Note: Entropy table assignment in jpeg_set_colorspace
|
* Note: Entropy table assignment in jpeg_set_colorspace depends
|
||||||
* depends on color_transform.
|
* on color_transform.
|
||||||
* Adaption is also required for setting the appropriate
|
|
||||||
* entropy coding mode dependent on image data precision.
|
|
||||||
*/
|
*/
|
||||||
dstinfo->color_transform = srcinfo->color_transform;
|
dstinfo->color_transform = srcinfo->color_transform;
|
||||||
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
|
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
|
||||||
dstinfo->data_precision = srcinfo->data_precision;
|
dstinfo->data_precision = srcinfo->data_precision;
|
||||||
dstinfo->arith_code = srcinfo->data_precision > 8 ? TRUE : FALSE;
|
|
||||||
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
|
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
|
||||||
/* Copy the source's quantization tables. */
|
/* Copy the source's quantization tables. */
|
||||||
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
|
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
|
||||||
@@ -160,18 +157,6 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LOCAL(void)
|
|
||||||
jpeg_calc_trans_dimensions (j_compress_ptr cinfo)
|
|
||||||
/* Do computations that are needed before master selection phase */
|
|
||||||
{
|
|
||||||
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
|
|
||||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
|
|
||||||
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
|
|
||||||
|
|
||||||
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Master selection of compression modules for transcoding.
|
* Master selection of compression modules for transcoding.
|
||||||
* This substitutes for jcinit.c's initialization of the full compressor.
|
* This substitutes for jcinit.c's initialization of the full compressor.
|
||||||
@@ -181,9 +166,6 @@ LOCAL(void)
|
|||||||
transencode_master_selection (j_compress_ptr cinfo,
|
transencode_master_selection (j_compress_ptr cinfo,
|
||||||
jvirt_barray_ptr * coef_arrays)
|
jvirt_barray_ptr * coef_arrays)
|
||||||
{
|
{
|
||||||
/* Do computations that are needed before master selection phase */
|
|
||||||
jpeg_calc_trans_dimensions(cinfo);
|
|
||||||
|
|
||||||
/* Initialize master control (includes parameter checking/processing) */
|
/* Initialize master control (includes parameter checking/processing) */
|
||||||
jinit_c_master_control(cinfo, TRUE /* transcode only */);
|
jinit_c_master_control(cinfo, TRUE /* transcode only */);
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
|||||||
* jdatadst.c
|
* jdatadst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2009-2017 by Guido Vollbeding.
|
* Modified 2009-2012 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -170,9 +170,9 @@ term_destination (j_compress_ptr cinfo)
|
|||||||
if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
|
if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
|
||||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||||
}
|
}
|
||||||
JFFLUSH(dest->outfile);
|
fflush(dest->outfile);
|
||||||
/* Make sure we wrote the output file OK */
|
/* Make sure we wrote the output file OK */
|
||||||
if (JFERROR(dest->outfile))
|
if (ferror(dest->outfile))
|
||||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-7
@@ -2,7 +2,7 @@
|
|||||||
* jdcolor.c
|
* jdcolor.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2011-2017 by Guido Vollbeding.
|
* Modified 2011-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -14,12 +14,6 @@
|
|||||||
#include "jpeglib.h"
|
#include "jpeglib.h"
|
||||||
|
|
||||||
|
|
||||||
#if RANGE_BITS < 2
|
|
||||||
/* Deliberate syntax err */
|
|
||||||
Sorry, this code requires 2 or more range extension bits.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Private subobject */
|
/* Private subobject */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
Vendored
+6
-5
@@ -2,7 +2,7 @@
|
|||||||
* jdct.h
|
* jdct.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2002-2017 by Guido Vollbeding.
|
* Modified 2002-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -79,12 +79,13 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
|
|||||||
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
|
* converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could
|
||||||
* be quite far out of range if the input data is corrupt, so a bulletproof
|
* be quite far out of range if the input data is corrupt, so a bulletproof
|
||||||
* range-limiting step is required. We use a mask-and-table-lookup method
|
* range-limiting step is required. We use a mask-and-table-lookup method
|
||||||
* to do the combined operations quickly, assuming that RANGE_CENTER
|
* to do the combined operations quickly, assuming that MAXJSAMPLE+1
|
||||||
* (defined in jpegint.h) is a power of 2. See the comments with
|
* is a power of 2. See the comments with prepare_range_limit_table
|
||||||
* prepare_range_limit_table (in jdmaster.c) for more info.
|
* (in jdmaster.c) for more info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RANGE_MASK (RANGE_CENTER * 2 - 1)
|
#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
|
||||||
|
#define RANGE_CENTER (MAXJSAMPLE * 2 + 2)
|
||||||
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
|
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
|
||||||
|
|
||||||
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
|
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
|
||||||
|
|||||||
Vendored
+5
-4
@@ -2,7 +2,7 @@
|
|||||||
* jdhuff.c
|
* jdhuff.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2006-2016 by Guido Vollbeding.
|
* Modified 2006-2013 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -799,6 +799,10 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
*/
|
*/
|
||||||
if (! entropy->insufficient_data) {
|
if (! entropy->insufficient_data) {
|
||||||
|
|
||||||
|
Se = cinfo->Se;
|
||||||
|
Al = cinfo->Al;
|
||||||
|
natural_order = cinfo->natural_order;
|
||||||
|
|
||||||
/* Load up working state.
|
/* Load up working state.
|
||||||
* We can avoid loading/saving bitread state if in an EOB run.
|
* We can avoid loading/saving bitread state if in an EOB run.
|
||||||
*/
|
*/
|
||||||
@@ -810,9 +814,6 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
|||||||
EOBRUN--; /* ...process it now (we do nothing) */
|
EOBRUN--; /* ...process it now (we do nothing) */
|
||||||
else {
|
else {
|
||||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||||
Se = cinfo->Se;
|
|
||||||
Al = cinfo->Al;
|
|
||||||
natural_order = cinfo->natural_order;
|
|
||||||
block = MCU_data[0];
|
block = MCU_data[0];
|
||||||
tbl = entropy->ac_derived_tbl;
|
tbl = entropy->ac_derived_tbl;
|
||||||
|
|
||||||
|
|||||||
Vendored
+26
-20
@@ -2,7 +2,7 @@
|
|||||||
* jdmainct.c
|
* jdmainct.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2002-2016 by Guido Vollbeding.
|
* Modified 2002-2012 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
* trivial. Its responsibility is to provide context rows for upsampling/
|
* trivial. Its responsibility is to provide context rows for upsampling/
|
||||||
* rescaling, and doing this in an efficient fashion is a bit tricky.
|
* rescaling, and doing this in an efficient fashion is a bit tricky.
|
||||||
*
|
*
|
||||||
* Postprocessor input data is counted in "row groups". A row group is
|
* Postprocessor input data is counted in "row groups". A row group
|
||||||
* defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size)
|
* is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
|
||||||
* sample rows of each component. (We require DCT_scaled_size values to be
|
* sample rows of each component. (We require DCT_scaled_size values to be
|
||||||
* chosen such that these numbers are integers. In practice DCT_scaled_size
|
* chosen such that these numbers are integers. In practice DCT_scaled_size
|
||||||
* values will likely be powers of two, so we actually have the stronger
|
* values will likely be powers of two, so we actually have the stronger
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
* applying).
|
* applying).
|
||||||
*
|
*
|
||||||
* The coefficient controller will deliver data to us one iMCU row at a time;
|
* The coefficient controller will deliver data to us one iMCU row at a time;
|
||||||
* each iMCU row contains v_samp_factor * DCT_v_scaled_size sample rows, or
|
* each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or
|
||||||
* exactly min_DCT_v_scaled_size row groups. (This amount of data corresponds
|
* exactly min_DCT_scaled_size row groups. (This amount of data corresponds
|
||||||
* to one row of MCUs when the image is fully interleaved.) Note that the
|
* to one row of MCUs when the image is fully interleaved.) Note that the
|
||||||
* number of sample rows varies across components, but the number of row
|
* number of sample rows varies across components, but the number of row
|
||||||
* groups does not. Some garbage sample rows may be included in the last iMCU
|
* groups does not. Some garbage sample rows may be included in the last iMCU
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
* We could do this most simply by copying data around in our buffer, but
|
* We could do this most simply by copying data around in our buffer, but
|
||||||
* that'd be very slow. We can avoid copying any data by creating a rather
|
* that'd be very slow. We can avoid copying any data by creating a rather
|
||||||
* strange pointer structure. Here's how it works. We allocate a workspace
|
* strange pointer structure. Here's how it works. We allocate a workspace
|
||||||
* consisting of M+2 row groups (where M = min_DCT_v_scaled_size is the number
|
* consisting of M+2 row groups (where M = min_DCT_scaled_size is the number
|
||||||
* of row groups per iMCU row). We create two sets of redundant pointers to
|
* of row groups per iMCU row). We create two sets of redundant pointers to
|
||||||
* the workspace. Labeling the physical row groups 0 to M+1, the synthesized
|
* the workspace. Labeling the physical row groups 0 to M+1, the synthesized
|
||||||
* pointer lists look like this:
|
* pointer lists look like this:
|
||||||
@@ -100,11 +100,11 @@
|
|||||||
* the first or last sample row as necessary (this is cheaper than copying
|
* the first or last sample row as necessary (this is cheaper than copying
|
||||||
* sample rows around).
|
* sample rows around).
|
||||||
*
|
*
|
||||||
* This scheme breaks down if M < 2, ie, min_DCT_v_scaled_size is 1. In that
|
* This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that
|
||||||
* situation each iMCU row provides only one row group so the buffering logic
|
* situation each iMCU row provides only one row group so the buffering logic
|
||||||
* must be different (eg, we must read two iMCU rows before we can emit the
|
* must be different (eg, we must read two iMCU rows before we can emit the
|
||||||
* first row group). For now, we simply do not support providing context
|
* first row group). For now, we simply do not support providing context
|
||||||
* rows when min_DCT_v_scaled_size is 1. That combination seems unlikely to
|
* rows when min_DCT_scaled_size is 1. That combination seems unlikely to
|
||||||
* be worth providing --- if someone wants a 1/8th-size preview, they probably
|
* be worth providing --- if someone wants a 1/8th-size preview, they probably
|
||||||
* want it quick and dirty, so a context-free upsampler is sufficient.
|
* want it quick and dirty, so a context-free upsampler is sufficient.
|
||||||
*/
|
*/
|
||||||
@@ -118,18 +118,17 @@ typedef struct {
|
|||||||
/* Pointer to allocated workspace (M or M+2 row groups). */
|
/* Pointer to allocated workspace (M or M+2 row groups). */
|
||||||
JSAMPARRAY buffer[MAX_COMPONENTS];
|
JSAMPARRAY buffer[MAX_COMPONENTS];
|
||||||
|
|
||||||
|
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
|
||||||
JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
|
JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */
|
||||||
JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
|
|
||||||
|
|
||||||
/* Remaining fields are only used in the context case. */
|
/* Remaining fields are only used in the context case. */
|
||||||
|
|
||||||
boolean buffer_full; /* Have we gotten an iMCU row from decoder? */
|
|
||||||
|
|
||||||
/* These are the master pointers to the funny-order pointer lists. */
|
/* These are the master pointers to the funny-order pointer lists. */
|
||||||
JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
|
JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
|
||||||
|
|
||||||
int whichptr; /* indicates which pointer set is now in use */
|
int whichptr; /* indicates which pointer set is now in use */
|
||||||
int context_state; /* process_data state machine status */
|
int context_state; /* process_data state machine status */
|
||||||
|
JDIMENSION rowgroups_avail; /* row groups available to postprocessor */
|
||||||
JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */
|
JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */
|
||||||
} my_main_controller;
|
} my_main_controller;
|
||||||
|
|
||||||
@@ -196,7 +195,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
|||||||
LOCAL(void)
|
LOCAL(void)
|
||||||
make_funny_pointers (j_decompress_ptr cinfo)
|
make_funny_pointers (j_decompress_ptr cinfo)
|
||||||
/* Create the funny pointer lists discussed in the comments above.
|
/* Create the funny pointer lists discussed in the comments above.
|
||||||
* The actual workspace is already allocated (in mainp->buffer),
|
* The actual workspace is already allocated (in main->buffer),
|
||||||
* and the space for the pointer lists is allocated too.
|
* and the space for the pointer lists is allocated too.
|
||||||
* This routine just fills in the curiously ordered lists.
|
* This routine just fills in the curiously ordered lists.
|
||||||
* This will be repeated at the beginning of each pass.
|
* This will be repeated at the beginning of each pass.
|
||||||
@@ -318,12 +317,12 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
|||||||
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||||
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||||
mainp->iMCU_row_ctr = 0;
|
mainp->iMCU_row_ctr = 0;
|
||||||
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
|
||||||
} else {
|
} else {
|
||||||
/* Simple case with no context needed */
|
/* Simple case with no context needed */
|
||||||
mainp->pub.process_data = process_data_simple_main;
|
mainp->pub.process_data = process_data_simple_main;
|
||||||
mainp->rowgroup_ctr = mainp->rowgroups_avail; /* Mark buffer empty */
|
|
||||||
}
|
}
|
||||||
|
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
||||||
|
mainp->rowgroup_ctr = 0;
|
||||||
break;
|
break;
|
||||||
#ifdef QUANT_2PASS_SUPPORTED
|
#ifdef QUANT_2PASS_SUPPORTED
|
||||||
case JBUF_CRANK_DEST:
|
case JBUF_CRANK_DEST:
|
||||||
@@ -349,14 +348,17 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
|||||||
JDIMENSION out_rows_avail)
|
JDIMENSION out_rows_avail)
|
||||||
{
|
{
|
||||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||||
|
JDIMENSION rowgroups_avail;
|
||||||
|
|
||||||
/* Read input data if we haven't filled the main buffer yet */
|
/* Read input data if we haven't filled the main buffer yet */
|
||||||
if (mainp->rowgroup_ctr >= mainp->rowgroups_avail) {
|
if (! mainp->buffer_full) {
|
||||||
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
||||||
return; /* suspension forced, can do nothing more */
|
return; /* suspension forced, can do nothing more */
|
||||||
mainp->rowgroup_ctr = 0; /* OK, we have an iMCU row to work with */
|
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
|
||||||
|
rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size;
|
||||||
/* Note: at the bottom of the image, we may pass extra garbage row groups
|
/* Note: at the bottom of the image, we may pass extra garbage row groups
|
||||||
* to the postprocessor. The postprocessor has to check for bottom
|
* to the postprocessor. The postprocessor has to check for bottom
|
||||||
* of image anyway (at row resolution), so no point in us doing it too.
|
* of image anyway (at row resolution), so no point in us doing it too.
|
||||||
@@ -364,8 +366,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
|||||||
|
|
||||||
/* Feed the postprocessor */
|
/* Feed the postprocessor */
|
||||||
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
||||||
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
&mainp->rowgroup_ctr, rowgroups_avail,
|
||||||
output_buf, out_row_ctr, out_rows_avail);
|
output_buf, out_row_ctr, out_rows_avail);
|
||||||
|
|
||||||
|
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
|
||||||
|
if (mainp->rowgroup_ctr >= rowgroups_avail) {
|
||||||
|
mainp->buffer_full = FALSE;
|
||||||
|
mainp->rowgroup_ctr = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -490,9 +498,7 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
|||||||
alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
|
alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
|
||||||
ngroups = cinfo->min_DCT_v_scaled_size + 2;
|
ngroups = cinfo->min_DCT_v_scaled_size + 2;
|
||||||
} else {
|
} else {
|
||||||
/* There are always min_DCT_v_scaled_size row groups in an iMCU row. */
|
|
||||||
ngroups = cinfo->min_DCT_v_scaled_size;
|
ngroups = cinfo->min_DCT_v_scaled_size;
|
||||||
mainp->rowgroups_avail = (JDIMENSION) ngroups;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||||
|
|||||||
Vendored
+7
-6
@@ -2,7 +2,7 @@
|
|||||||
* jdmaster.c
|
* jdmaster.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 2002-2017 by Guido Vollbeding.
|
* Modified 2002-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -237,17 +237,18 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
|
|||||||
JSAMPLE * table;
|
JSAMPLE * table;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
|
table = (JSAMPLE *)
|
||||||
JPOOL_IMAGE, (RANGE_CENTER * 2 + MAXJSAMPLE + 1) * SIZEOF(JSAMPLE));
|
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||||
|
5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||||
/* First segment of range limit table: limit[x] = 0 for x < 0 */
|
/* First segment of range limit table: limit[x] = 0 for x < 0 */
|
||||||
MEMZERO(table, RANGE_CENTER * SIZEOF(JSAMPLE));
|
MEMZERO(table, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||||
table += RANGE_CENTER; /* allow negative subscripts of table */
|
table += 2 * (MAXJSAMPLE+1); /* allow negative subscripts of table */
|
||||||
cinfo->sample_range_limit = table;
|
cinfo->sample_range_limit = table;
|
||||||
/* Main part of range limit table: limit[x] = x */
|
/* Main part of range limit table: limit[x] = x */
|
||||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||||
table[i] = (JSAMPLE) i;
|
table[i] = (JSAMPLE) i;
|
||||||
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
|
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
|
||||||
for (; i <= MAXJSAMPLE + RANGE_CENTER; i++)
|
for (; i < 3 * (MAXJSAMPLE+1); i++)
|
||||||
table[i] = MAXJSAMPLE;
|
table[i] = MAXJSAMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-7
@@ -2,7 +2,7 @@
|
|||||||
* jdmerge.c
|
* jdmerge.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2013-2017 by Guido Vollbeding.
|
* Modified 2013-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -40,12 +40,6 @@
|
|||||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||||
|
|
||||||
|
|
||||||
#if RANGE_BITS < 2
|
|
||||||
/* Deliberate syntax err */
|
|
||||||
Sorry, this code requires 2 or more range extension bits.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Private subobject */
|
/* Private subobject */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* jfdctflt.c
|
* jfdctflt.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2003-2017 by Guido Vollbeding.
|
* Modified 2003-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* jfdctfst.c
|
* jfdctfst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||||
* Modified 2003-2017 by Guido Vollbeding.
|
* Modified 2003-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* jidctflt.c
|
* jidctflt.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||||
* Modified 2010-2017 by Guido Vollbeding.
|
* Modified 2010-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
* jidctfst.c
|
* jidctfst.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||||
* Modified 2015-2017 by Guido Vollbeding.
|
* Modified 2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if DCTSIZE != 8
|
#if DCTSIZE != 8
|
||||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+17
-18
@@ -2,7 +2,7 @@
|
|||||||
* jidctint.c
|
* jidctint.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||||
* Modification developed 2002-2016 by Guido Vollbeding.
|
* Modification developed 2002-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -166,7 +166,6 @@
|
|||||||
/*
|
/*
|
||||||
* Perform dequantization and inverse DCT on one block of coefficients.
|
* Perform dequantization and inverse DCT on one block of coefficients.
|
||||||
*
|
*
|
||||||
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
|
||||||
* cK represents sqrt(2) * cos(K*pi/16).
|
* cK represents sqrt(2) * cos(K*pi/16).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -429,7 +428,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||||
* producing a reduced-size 7x7 output block.
|
* producing a 7x7 output block.
|
||||||
*
|
*
|
||||||
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
||||||
* cK represents sqrt(2) * cos(K*pi/14).
|
* cK represents sqrt(2) * cos(K*pi/14).
|
||||||
@@ -2624,7 +2623,7 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||||
tmp0 <<= CONST_BITS;
|
tmp0 <<= CONST_BITS;
|
||||||
/* Add fudge factor here for final descale. */
|
/* Add fudge factor here for final descale. */
|
||||||
tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
|
tmp0 += 1 << (CONST_BITS-PASS1_BITS-1);
|
||||||
|
|
||||||
z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||||
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
|
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
|
||||||
@@ -2921,6 +2920,13 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* The rotator is c(-6).
|
* The rotator is c(-6).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
||||||
|
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
||||||
|
|
||||||
|
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
||||||
|
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
||||||
|
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||||
z2 <<= CONST_BITS;
|
z2 <<= CONST_BITS;
|
||||||
@@ -2931,13 +2937,6 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
tmp0 = z2 + z3;
|
tmp0 = z2 + z3;
|
||||||
tmp1 = z2 - z3;
|
tmp1 = z2 - z3;
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
|
||||||
|
|
||||||
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
|
||||||
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
|
||||||
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
|
||||||
|
|
||||||
tmp10 = tmp0 + tmp2;
|
tmp10 = tmp0 + tmp2;
|
||||||
tmp13 = tmp0 - tmp2;
|
tmp13 = tmp0 - tmp2;
|
||||||
tmp11 = tmp1 + tmp3;
|
tmp11 = tmp1 + tmp3;
|
||||||
@@ -4884,6 +4883,13 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
* The rotator is c(-6).
|
* The rotator is c(-6).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
||||||
|
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
||||||
|
|
||||||
|
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
||||||
|
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
||||||
|
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||||
z2 <<= CONST_BITS;
|
z2 <<= CONST_BITS;
|
||||||
@@ -4894,13 +4900,6 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
|||||||
tmp0 = z2 + z3;
|
tmp0 = z2 + z3;
|
||||||
tmp1 = z2 - z3;
|
tmp1 = z2 - z3;
|
||||||
|
|
||||||
z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
|
|
||||||
z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
|
|
||||||
|
|
||||||
z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */
|
|
||||||
tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */
|
|
||||||
tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */
|
|
||||||
|
|
||||||
tmp10 = tmp0 + tmp2;
|
tmp10 = tmp0 + tmp2;
|
||||||
tmp13 = tmp0 - tmp2;
|
tmp13 = tmp0 - tmp2;
|
||||||
tmp11 = tmp1 + tmp3;
|
tmp11 = tmp1 + tmp3;
|
||||||
|
|||||||
Vendored
-6
@@ -2,7 +2,6 @@
|
|||||||
* jinclude.h
|
* jinclude.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1994, Thomas G. Lane.
|
* Copyright (C) 1991-1994, Thomas G. Lane.
|
||||||
* Modified 2017 by Guido Vollbeding.
|
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -84,14 +83,9 @@
|
|||||||
* The modules that use fread() and fwrite() always invoke them through
|
* The modules that use fread() and fwrite() always invoke them through
|
||||||
* these macros. On some systems you may need to twiddle the argument casts.
|
* these macros. On some systems you may need to twiddle the argument casts.
|
||||||
* CAUTION: argument order is different from underlying functions!
|
* CAUTION: argument order is different from underlying functions!
|
||||||
*
|
|
||||||
* Furthermore, macros are provided for fflush() and ferror() in order
|
|
||||||
* to facilitate adaption by applications using an own FILE class.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JFREAD(file,buf,sizeofbuf) \
|
#define JFREAD(file,buf,sizeofbuf) \
|
||||||
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||||
#define JFWRITE(file,buf,sizeofbuf) \
|
#define JFWRITE(file,buf,sizeofbuf) \
|
||||||
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||||
#define JFFLUSH(file) fflush(file)
|
|
||||||
#define JFERROR(file) ferror(file)
|
|
||||||
|
|||||||
Vendored
+1
-14
@@ -2,7 +2,7 @@
|
|||||||
* jpegint.h
|
* jpegint.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||||
* Modified 1997-2017 by Guido Vollbeding.
|
* Modified 1997-2013 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -260,19 +260,6 @@ struct jpeg_color_quantizer {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Definition of range extension bits for decompression processes.
|
|
||||||
* See the comments with prepare_range_limit_table (in jdmaster.c)
|
|
||||||
* for more info.
|
|
||||||
* The recommended default value for normal applications is 2.
|
|
||||||
* Applications with special requirements may use a different value.
|
|
||||||
* For example, Ghostscript wants to use 3 for proper handling of
|
|
||||||
* wacky images with oversize coefficient values.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define RANGE_BITS 2
|
|
||||||
#define RANGE_CENTER (CENTERJSAMPLE << RANGE_BITS)
|
|
||||||
|
|
||||||
|
|
||||||
/* Miscellaneous useful macros */
|
/* Miscellaneous useful macros */
|
||||||
|
|
||||||
#undef MAX
|
#undef MAX
|
||||||
|
|||||||
Vendored
+14
-14
@@ -2,7 +2,7 @@
|
|||||||
* jpeglib.h
|
* jpeglib.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||||
* Modified 2002-2017 by Guido Vollbeding.
|
* Modified 2002-2015 by Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* 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 90 /* Compatibility version 9.0 */
|
||||||
#define JPEG_LIB_VERSION_MAJOR 9
|
#define JPEG_LIB_VERSION_MAJOR 9
|
||||||
#define JPEG_LIB_VERSION_MINOR 3
|
#define JPEG_LIB_VERSION_MINOR 2
|
||||||
|
|
||||||
|
|
||||||
/* Various constants determining the sizes of things.
|
/* Various constants determining the sizes of things.
|
||||||
@@ -137,9 +137,9 @@ typedef struct {
|
|||||||
/* The decompressor output side may not use these variables. */
|
/* The decompressor output side may not use these variables. */
|
||||||
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
||||||
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
||||||
|
|
||||||
/* Remaining fields should be treated as private by applications. */
|
/* Remaining fields should be treated as private by applications. */
|
||||||
|
|
||||||
/* These values are computed during compression or decompression startup: */
|
/* These values are computed during compression or decompression startup: */
|
||||||
/* Component's size in DCT blocks.
|
/* Component's size in DCT blocks.
|
||||||
* Any dummy blocks added to complete an MCU are not counted; therefore
|
* Any dummy blocks added to complete an MCU are not counted; therefore
|
||||||
@@ -411,10 +411,10 @@ struct jpeg_compress_struct {
|
|||||||
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
JDIMENSION total_iMCU_rows; /* # of iMCU rows to be input to coef ctlr */
|
||||||
/* The coefficient controller receives data in units of MCU rows as defined
|
/* The coefficient controller receives data in units of MCU rows as defined
|
||||||
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
||||||
* There are v_samp_factor * DCT_v_scaled_size sample rows of each component
|
* There are v_samp_factor * DCTSIZE sample rows of each component in an
|
||||||
* in an "iMCU" (interleaved MCU) row.
|
* "iMCU" (interleaved MCU) row.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These fields are valid during any one scan.
|
* These fields are valid during any one scan.
|
||||||
* They describe the components and MCUs actually appearing in the scan.
|
* They describe the components and MCUs actually appearing in the scan.
|
||||||
@@ -422,10 +422,10 @@ struct jpeg_compress_struct {
|
|||||||
int comps_in_scan; /* # of JPEG components in this scan */
|
int comps_in_scan; /* # of JPEG components in this scan */
|
||||||
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
||||||
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
||||||
|
|
||||||
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||||
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||||
|
|
||||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||||
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
||||||
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
/* MCU_membership[i] is index in cur_comp_info of component owning */
|
||||||
@@ -636,7 +636,7 @@ struct jpeg_decompress_struct {
|
|||||||
* in fully interleaved JPEG scans, but are used whether the scan is
|
* in fully interleaved JPEG scans, but are used whether the scan is
|
||||||
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||||
* rows of each component. Therefore, the IDCT output contains
|
* rows of each component. Therefore, the IDCT output contains
|
||||||
* v_samp_factor * DCT_v_scaled_size sample rows of a component per iMCU row.
|
* v_samp_factor*DCT_v_scaled_size sample rows of a component per iMCU row.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
|
JSAMPLE * sample_range_limit; /* table for fast range-limiting */
|
||||||
@@ -711,7 +711,7 @@ struct jpeg_error_mgr {
|
|||||||
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
||||||
/* Reset error state variables at start of a new image */
|
/* Reset error state variables at start of a new image */
|
||||||
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
|
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
|
||||||
|
|
||||||
/* The message ID code and any parameters are saved here.
|
/* The message ID code and any parameters are saved here.
|
||||||
* A message can have one string parameter or up to 8 int parameters.
|
* A message can have one string parameter or up to 8 int parameters.
|
||||||
*/
|
*/
|
||||||
@@ -721,11 +721,11 @@ struct jpeg_error_mgr {
|
|||||||
int i[8];
|
int i[8];
|
||||||
char s[JMSG_STR_PARM_MAX];
|
char s[JMSG_STR_PARM_MAX];
|
||||||
} msg_parm;
|
} msg_parm;
|
||||||
|
|
||||||
/* Standard state variables for error facility */
|
/* Standard state variables for error facility */
|
||||||
|
|
||||||
int trace_level; /* max msg_level that will be displayed */
|
int trace_level; /* max msg_level that will be displayed */
|
||||||
|
|
||||||
/* For recoverable corrupt-data errors, we emit a warning message,
|
/* For recoverable corrupt-data errors, we emit a warning message,
|
||||||
* but keep going unless emit_message chooses to abort. emit_message
|
* but keep going unless emit_message chooses to abort. emit_message
|
||||||
* should count warnings in num_warnings. The surrounding application
|
* should count warnings in num_warnings. The surrounding application
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* jversion.h
|
* jversion.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
* Copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
||||||
* This file is part of the Independent JPEG Group's software.
|
* This file is part of the Independent JPEG Group's software.
|
||||||
* For conditions of distribution and use, see the accompanying README file.
|
* For conditions of distribution and use, see the accompanying README file.
|
||||||
*
|
*
|
||||||
@@ -9,6 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define JVERSION "9c 14-Jan-2018"
|
#define JVERSION "9b 17-Jan-2016"
|
||||||
|
|
||||||
#define JCOPYRIGHT "Copyright (C) 2018, Thomas G. Lane, Guido Vollbeding"
|
#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding"
|
||||||
|
|||||||
Vendored
+13
-26
@@ -6066,44 +6066,31 @@ Version 1.6.35 [July 15, 2018]
|
|||||||
Version 1.6.36 [December 1, 2018]
|
Version 1.6.36 [December 1, 2018]
|
||||||
Optimized png_do_expand_palette for ARM processors.
|
Optimized png_do_expand_palette for ARM processors.
|
||||||
Improved performance by around 10-22% on a recent ARM Chromebook.
|
Improved performance by around 10-22% on a recent ARM Chromebook.
|
||||||
(Contributed by Richard Townsend, ARM Holdings)
|
(Contributed by Richard Townsend, ARM Holdings)
|
||||||
Fixed manipulation of machine-specific optimization options.
|
Fixed manipulation of machine-specific optimization options.
|
||||||
(Contributed by Vicki Pfau)
|
(Contributed by Vicki Pfau)
|
||||||
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
|
Used memcpy instead of manual pointer arithmetic on Intel SSE2.
|
||||||
(Contributed by Samuel Williams)
|
(Contributed by Samuel Williams)
|
||||||
Fixed build errors with MSVC on ARM64.
|
Fixed build errors with MSVC on ARM64.
|
||||||
(Contributed by Zhijie Liang)
|
(Contributed by Zhijie Liang)
|
||||||
Fixed detection of libm in CMakeLists.
|
Fixed detection of libm in CMakeLists.
|
||||||
(Contributed by Cameron Cawley)
|
(Contributed by Cameron Cawley)
|
||||||
Fixed incorrect creation of pkg-config file in CMakeLists.
|
Fixed incorrect creation of pkg-config file in CMakeLists.
|
||||||
(Contributed by Kyle Bentley)
|
(Contributed by Kyle Bentley)
|
||||||
Fixed the CMake build on Windows MSYS by avoiding symlinks.
|
Fixed the CMake build on Windows MSYS by avoiding symlinks.
|
||||||
Fixed a build warning on OpenBSD.
|
Fixed a build warning on OpenBSD.
|
||||||
(Contributed by Theo Buehler)
|
(Contributed by Theo Buehler)
|
||||||
Fixed various typos in comments.
|
Fixed various typos in comments.
|
||||||
(Contributed by "luz.paz")
|
(Contributed by "luz.paz")
|
||||||
Raised the minimum required CMake version from 3.0.2 to 3.1.
|
Raised the minimum required CMake version from 3.0.2 to 3.1.
|
||||||
Removed yet more of the vestigial support for pre-ANSI C compilers.
|
Removed yet more of the vestigial support for pre-ANSI C compilers.
|
||||||
Removed ancient makefiles for ancient systems that have been broken
|
Removed ancient makefiles for ancient systems that have been broken
|
||||||
across all previous libpng-1.6.x versions.
|
across all previous libpng-1.6.x versions.
|
||||||
Removed the Y2K compliance statement and the export control
|
Removed the Y2K compliance statement and the export control
|
||||||
information.
|
information.
|
||||||
Applied various code style and documentation fixes.
|
Applied various code style and documentation fixes.
|
||||||
|
|
||||||
Version 1.6.37 [April 14, 2019]
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
(subscription required; visit
|
||||||
Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
|
|
||||||
Fixed a memory leak in pngtest.c.
|
|
||||||
Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
|
|
||||||
contrib/pngminus; refactor.
|
|
||||||
Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
|
|
||||||
(Contributed by Willem van Schaik)
|
|
||||||
Fixed a typo in the libpng license v2.
|
|
||||||
(Contributed by Miguel Ojeda)
|
|
||||||
Added makefiles for AddressSanitizer-enabled builds.
|
|
||||||
Cleaned up various makefiles.
|
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
|
|
||||||
Subscription is required; visit
|
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe.
|
to subscribe).
|
||||||
|
|||||||
Vendored
+1
-12
@@ -46,19 +46,8 @@ if(";${CPU_BASELINE_FINAL};" MATCHES "SSE2"
|
|||||||
add_definitions(-DPNG_INTEL_SSE)
|
add_definitions(-DPNG_INTEL_SSE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# set definitions and sources for MIPS
|
|
||||||
if(";${CPU_BASELINE_FINAL};" MATCHES "MSA")
|
|
||||||
list(APPEND lib_srcs mips/mips_init.c mips/filter_msa_intrinsics.c)
|
|
||||||
add_definitions(-DPNG_MIPS_MSA_OPT=2)
|
|
||||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wshadow)
|
|
||||||
else()
|
|
||||||
add_definitions(-DPNG_MIPS_MSA_OPT=0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PPC64LE OR PPC64)
|
if(PPC64LE OR PPC64)
|
||||||
# VSX3 features are backwards compatible
|
if(ENABLE_VSX AND NOT PPC64)
|
||||||
if(";${CPU_BASELINE_FINAL};" MATCHES "VSX.*"
|
|
||||||
AND NOT PPC64)
|
|
||||||
list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c)
|
list(APPEND lib_srcs powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c)
|
||||||
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
|
add_definitions(-DPNG_POWERPC_VSX_OPT=2)
|
||||||
else()
|
else()
|
||||||
|
|||||||
Vendored
+4
-4
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
|||||||
PNG Reference Library License version 2
|
PNG Reference Library License version 2
|
||||||
---------------------------------------
|
---------------------------------------
|
||||||
|
|
||||||
* Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
* Copyright (c) 1995-2018 The PNG Reference Library Authors.
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta.
|
* Copyright (c) 2018 Cosmin Truta.
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -13,7 +13,7 @@ PNG Reference Library License version 2
|
|||||||
The software is supplied "as is", without warranty of any kind,
|
The software is supplied "as is", without warranty of any kind,
|
||||||
express or implied, including, without limitation, the warranties
|
express or implied, including, without limitation, the warranties
|
||||||
of merchantability, fitness for a particular purpose, title, and
|
of merchantability, fitness for a particular purpose, title, and
|
||||||
non-infringement. In no event shall the Copyright owners, or
|
non-infringement. In no even shall the Copyright owners, or
|
||||||
anyone distributing the software, be liable for any damages or
|
anyone distributing the software, be liable for any damages or
|
||||||
other liability, whether in contract, tort or otherwise, arising
|
other liability, whether in contract, tort or otherwise, arising
|
||||||
from, out of, or in connection with the software, or the use or
|
from, out of, or in connection with the software, or the use or
|
||||||
@@ -39,7 +39,7 @@ subject to the following restrictions:
|
|||||||
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
|
libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
|
||||||
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
||||||
derived from libpng-1.0.6, and are distributed according to the same
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
README for libpng version 1.6.37 - April 14, 2019
|
README for libpng version 1.6.36 - December 1, 2018
|
||||||
=================================================
|
===================================================
|
||||||
|
|
||||||
See the note about version numbers near the top of png.h.
|
See the note about version numbers near the top of png.h.
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|||||||
+16
-16
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
|
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
|
||||||
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
|
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
|
||||||
*
|
*
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
# include <arm_neon.h>
|
# include <arm_neon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
|
/* Build an RGBA palette from the RGB and separate alpha palettes. */
|
||||||
void
|
void
|
||||||
png_riffle_palette_neon(png_structrp png_ptr)
|
png_riffle_palette_rgba(png_structrp png_ptr, png_row_infop row_info)
|
||||||
{
|
{
|
||||||
png_const_colorp palette = png_ptr->palette;
|
png_const_colorp palette = png_ptr->palette;
|
||||||
png_bytep riffled_palette = png_ptr->riffled_palette;
|
png_bytep riffled_palette = png_ptr->riffled_palette;
|
||||||
@@ -30,8 +30,6 @@ png_riffle_palette_neon(png_structrp png_ptr)
|
|||||||
int num_trans = png_ptr->num_trans;
|
int num_trans = png_ptr->num_trans;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_debug(1, "in png_riffle_palette_neon");
|
|
||||||
|
|
||||||
/* Initially black, opaque. */
|
/* Initially black, opaque. */
|
||||||
uint8x16x4_t w = {{
|
uint8x16x4_t w = {{
|
||||||
vdupq_n_u8(0x00),
|
vdupq_n_u8(0x00),
|
||||||
@@ -40,10 +38,16 @@ png_riffle_palette_neon(png_structrp png_ptr)
|
|||||||
vdupq_n_u8(0xff),
|
vdupq_n_u8(0xff),
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/* First, riffle the RGB colours into an RGBA8 palette.
|
if (row_info->bit_depth != 8)
|
||||||
* The alpha component is set to opaque for now.
|
{
|
||||||
|
png_error(png_ptr, "bit_depth must be 8 for png_riffle_palette_rgba");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* First, riffle the RGB colours into a RGBA palette, the A value is
|
||||||
|
* set to opaque for now.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < 256; i += 16)
|
for (i = 0; i < (1 << row_info->bit_depth); i += 16)
|
||||||
{
|
{
|
||||||
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
|
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
|
||||||
w.val[0] = v.val[0];
|
w.val[0] = v.val[0];
|
||||||
@@ -57,9 +61,9 @@ png_riffle_palette_neon(png_structrp png_ptr)
|
|||||||
riffled_palette[(i << 2) + 3] = trans_alpha[i];
|
riffled_palette[(i << 2) + 3] = trans_alpha[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expands a palettized row into RGBA8. */
|
/* Expands a palettized row into RGBA. */
|
||||||
int
|
int
|
||||||
png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
png_do_expand_palette_neon_rgba(png_structrp png_ptr, png_row_infop row_info,
|
||||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@@ -68,8 +72,6 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|||||||
const png_int_32 pixels_per_chunk = 4;
|
const png_int_32 pixels_per_chunk = 4;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
|
||||||
|
|
||||||
if (row_width < pixels_per_chunk)
|
if (row_width < pixels_per_chunk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -101,9 +103,9 @@ png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Expands a palettized row into RGB8. */
|
/* Expands a palettized row into RGB format. */
|
||||||
int
|
int
|
||||||
png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
png_do_expand_palette_neon_rgb(png_structrp png_ptr, png_row_infop row_info,
|
||||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
@@ -111,8 +113,6 @@ png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
|||||||
const png_uint_32 pixels_per_chunk = 8;
|
const png_uint_32 pixels_per_chunk = 8;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
|
||||||
|
|
||||||
if (row_width <= pixels_per_chunk)
|
if (row_width <= pixels_per_chunk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
-808
@@ -1,808 +0,0 @@
|
|||||||
|
|
||||||
/* filter_msa_intrinsics.c - MSA optimised filter functions
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
|
||||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
|
||||||
* Written by Mandar Sahastrabuddhe, August 2016.
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "../pngpriv.h"
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
|
|
||||||
/* This code requires -mfpu=msa on the command line: */
|
|
||||||
#if PNG_MIPS_MSA_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */
|
|
||||||
|
|
||||||
#include <msa.h>
|
|
||||||
|
|
||||||
/* libpng row pointers are not necessarily aligned to any particular boundary,
|
|
||||||
* however this code will only work with appropriate alignment. mips/mips_init.c
|
|
||||||
* checks for this (and will not compile unless it is done). This code uses
|
|
||||||
* variants of png_aligncast to avoid compiler warnings.
|
|
||||||
*/
|
|
||||||
#define png_ptr(type,pointer) png_aligncast(type *,pointer)
|
|
||||||
#define png_ptrc(type,pointer) png_aligncastconst(const type *,pointer)
|
|
||||||
|
|
||||||
/* The following relies on a variable 'temp_pointer' being declared with type
|
|
||||||
* 'type'. This is written this way just to hide the GCC strict aliasing
|
|
||||||
* warning; note that the code is safe because there never is an alias between
|
|
||||||
* the input and output pointers.
|
|
||||||
*/
|
|
||||||
#define png_ldr(type,pointer)\
|
|
||||||
(temp_pointer = png_ptr(type,pointer), *temp_pointer)
|
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
|
||||||
|
|
||||||
#ifdef CLANG_BUILD
|
|
||||||
#define MSA_SRLI_B(a, b) __msa_srli_b((v16i8) a, b)
|
|
||||||
|
|
||||||
#define LW(psrc) \
|
|
||||||
( { \
|
|
||||||
uint8_t *psrc_lw_m = (uint8_t *) (psrc); \
|
|
||||||
uint32_t val_m; \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"lw %[val_m], %[psrc_lw_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [val_m] "=r" (val_m) \
|
|
||||||
: [psrc_lw_m] "m" (*psrc_lw_m) \
|
|
||||||
); \
|
|
||||||
\
|
|
||||||
val_m; \
|
|
||||||
} )
|
|
||||||
|
|
||||||
#define SH(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sh_m = (uint8_t *) (pdst); \
|
|
||||||
uint16_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"sh %[val_m], %[pdst_sh_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sh_m] "=m" (*pdst_sh_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SW(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sw_m = (uint8_t *) (pdst); \
|
|
||||||
uint32_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"sw %[val_m], %[pdst_sw_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sw_m] "=m" (*pdst_sw_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (__mips == 64)
|
|
||||||
#define SD(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
|
||||||
uint64_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"sd %[val_m], %[pdst_sd_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sd_m] "=m" (*pdst_sd_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define SD(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
|
||||||
uint32_t val0_m, val1_m; \
|
|
||||||
\
|
|
||||||
val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF); \
|
|
||||||
val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF); \
|
|
||||||
\
|
|
||||||
SW(val0_m, pdst_sd_m); \
|
|
||||||
SW(val1_m, pdst_sd_m + 4); \
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define MSA_SRLI_B(a, b) (a >> b)
|
|
||||||
|
|
||||||
#if (__mips_isa_rev >= 6)
|
|
||||||
#define LW(psrc) \
|
|
||||||
( { \
|
|
||||||
uint8_t *psrc_lw_m = (uint8_t *) (psrc); \
|
|
||||||
uint32_t val_m; \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"lw %[val_m], %[psrc_lw_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [val_m] "=r" (val_m) \
|
|
||||||
: [psrc_lw_m] "m" (*psrc_lw_m) \
|
|
||||||
); \
|
|
||||||
\
|
|
||||||
val_m; \
|
|
||||||
} )
|
|
||||||
|
|
||||||
#define SH(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sh_m = (uint8_t *) (pdst); \
|
|
||||||
uint16_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"sh %[val_m], %[pdst_sh_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sh_m] "=m" (*pdst_sh_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SW(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sw_m = (uint8_t *) (pdst); \
|
|
||||||
uint32_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"sw %[val_m], %[pdst_sw_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sw_m] "=m" (*pdst_sw_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (__mips == 64)
|
|
||||||
#define SD(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
|
||||||
uint64_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"sd %[val_m], %[pdst_sd_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sd_m] "=m" (*pdst_sd_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define SD(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
|
||||||
uint32_t val0_m, val1_m; \
|
|
||||||
\
|
|
||||||
val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF); \
|
|
||||||
val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF); \
|
|
||||||
\
|
|
||||||
SW(val0_m, pdst_sd_m); \
|
|
||||||
SW(val1_m, pdst_sd_m + 4); \
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else // !(__mips_isa_rev >= 6)
|
|
||||||
#define LW(psrc) \
|
|
||||||
( { \
|
|
||||||
uint8_t *psrc_lw_m = (uint8_t *) (psrc); \
|
|
||||||
uint32_t val_m; \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"ulw %[val_m], %[psrc_lw_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [val_m] "=r" (val_m) \
|
|
||||||
: [psrc_lw_m] "m" (*psrc_lw_m) \
|
|
||||||
); \
|
|
||||||
\
|
|
||||||
val_m; \
|
|
||||||
} )
|
|
||||||
|
|
||||||
#define SH(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sh_m = (uint8_t *) (pdst); \
|
|
||||||
uint16_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"ush %[val_m], %[pdst_sh_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sh_m] "=m" (*pdst_sh_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SW(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sw_m = (uint8_t *) (pdst); \
|
|
||||||
uint32_t val_m = (val); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"usw %[val_m], %[pdst_sw_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_sw_m] "=m" (*pdst_sw_m) \
|
|
||||||
: [val_m] "r" (val_m) \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SD(val, pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_sd_m = (uint8_t *) (pdst); \
|
|
||||||
uint32_t val0_m, val1_m; \
|
|
||||||
\
|
|
||||||
val0_m = (uint32_t) ((val) & 0x00000000FFFFFFFF); \
|
|
||||||
val1_m = (uint32_t) (((val) >> 32) & 0x00000000FFFFFFFF); \
|
|
||||||
\
|
|
||||||
SW(val0_m, pdst_sd_m); \
|
|
||||||
SW(val1_m, pdst_sd_m + 4); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SW_ZERO(pdst) \
|
|
||||||
{ \
|
|
||||||
uint8_t *pdst_m = (uint8_t *) (pdst); \
|
|
||||||
\
|
|
||||||
asm volatile ( \
|
|
||||||
"usw $0, %[pdst_m] \n\t" \
|
|
||||||
\
|
|
||||||
: [pdst_m] "=m" (*pdst_m) \
|
|
||||||
: \
|
|
||||||
); \
|
|
||||||
}
|
|
||||||
#endif // (__mips_isa_rev >= 6)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LD_B(RTYPE, psrc) *((RTYPE *) (psrc))
|
|
||||||
#define LD_UB(...) LD_B(v16u8, __VA_ARGS__)
|
|
||||||
#define LD_B2(RTYPE, psrc, stride, out0, out1) \
|
|
||||||
{ \
|
|
||||||
out0 = LD_B(RTYPE, (psrc)); \
|
|
||||||
out1 = LD_B(RTYPE, (psrc) + stride); \
|
|
||||||
}
|
|
||||||
#define LD_UB2(...) LD_B2(v16u8, __VA_ARGS__)
|
|
||||||
#define LD_B4(RTYPE, psrc, stride, out0, out1, out2, out3) \
|
|
||||||
{ \
|
|
||||||
LD_B2(RTYPE, (psrc), stride, out0, out1); \
|
|
||||||
LD_B2(RTYPE, (psrc) + 2 * stride , stride, out2, out3); \
|
|
||||||
}
|
|
||||||
#define LD_UB4(...) LD_B4(v16u8, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define ST_B(RTYPE, in, pdst) *((RTYPE *) (pdst)) = (in)
|
|
||||||
#define ST_UB(...) ST_B(v16u8, __VA_ARGS__)
|
|
||||||
#define ST_B2(RTYPE, in0, in1, pdst, stride) \
|
|
||||||
{ \
|
|
||||||
ST_B(RTYPE, in0, (pdst)); \
|
|
||||||
ST_B(RTYPE, in1, (pdst) + stride); \
|
|
||||||
}
|
|
||||||
#define ST_UB2(...) ST_B2(v16u8, __VA_ARGS__)
|
|
||||||
#define ST_B4(RTYPE, in0, in1, in2, in3, pdst, stride) \
|
|
||||||
{ \
|
|
||||||
ST_B2(RTYPE, in0, in1, (pdst), stride); \
|
|
||||||
ST_B2(RTYPE, in2, in3, (pdst) + 2 * stride, stride); \
|
|
||||||
}
|
|
||||||
#define ST_UB4(...) ST_B4(v16u8, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define ADD2(in0, in1, in2, in3, out0, out1) \
|
|
||||||
{ \
|
|
||||||
out0 = in0 + in1; \
|
|
||||||
out1 = in2 + in3; \
|
|
||||||
}
|
|
||||||
#define ADD3(in0, in1, in2, in3, in4, in5, \
|
|
||||||
out0, out1, out2) \
|
|
||||||
{ \
|
|
||||||
ADD2(in0, in1, in2, in3, out0, out1); \
|
|
||||||
out2 = in4 + in5; \
|
|
||||||
}
|
|
||||||
#define ADD4(in0, in1, in2, in3, in4, in5, in6, in7, \
|
|
||||||
out0, out1, out2, out3) \
|
|
||||||
{ \
|
|
||||||
ADD2(in0, in1, in2, in3, out0, out1); \
|
|
||||||
ADD2(in4, in5, in6, in7, out2, out3); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ILVR_B2(RTYPE, in0, in1, in2, in3, out0, out1) \
|
|
||||||
{ \
|
|
||||||
out0 = (RTYPE) __msa_ilvr_b((v16i8) in0, (v16i8) in1); \
|
|
||||||
out1 = (RTYPE) __msa_ilvr_b((v16i8) in2, (v16i8) in3); \
|
|
||||||
}
|
|
||||||
#define ILVR_B2_SH(...) ILVR_B2(v8i16, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define HSUB_UB2(RTYPE, in0, in1, out0, out1) \
|
|
||||||
{ \
|
|
||||||
out0 = (RTYPE) __msa_hsub_u_h((v16u8) in0, (v16u8) in0); \
|
|
||||||
out1 = (RTYPE) __msa_hsub_u_h((v16u8) in1, (v16u8) in1); \
|
|
||||||
}
|
|
||||||
#define HSUB_UB2_SH(...) HSUB_UB2(v8i16, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val) \
|
|
||||||
{ \
|
|
||||||
v16i8 zero_m = { 0 }; \
|
|
||||||
out0 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in0, slide_val); \
|
|
||||||
out1 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in1, slide_val); \
|
|
||||||
}
|
|
||||||
#define SLDI_B2_0_UB(...) SLDI_B2_0(v16u8, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define SLDI_B3_0(RTYPE, in0, in1, in2, out0, out1, out2, slide_val) \
|
|
||||||
{ \
|
|
||||||
v16i8 zero_m = { 0 }; \
|
|
||||||
SLDI_B2_0(RTYPE, in0, in1, out0, out1, slide_val); \
|
|
||||||
out2 = (RTYPE) __msa_sldi_b((v16i8) zero_m, (v16i8) in2, slide_val); \
|
|
||||||
}
|
|
||||||
#define SLDI_B3_0_UB(...) SLDI_B3_0(v16u8, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define ILVEV_W2(RTYPE, in0, in1, in2, in3, out0, out1) \
|
|
||||||
{ \
|
|
||||||
out0 = (RTYPE) __msa_ilvev_w((v4i32) in1, (v4i32) in0); \
|
|
||||||
out1 = (RTYPE) __msa_ilvev_w((v4i32) in3, (v4i32) in2); \
|
|
||||||
}
|
|
||||||
#define ILVEV_W2_UB(...) ILVEV_W2(v16u8, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define ADD_ABS_H3(RTYPE, in0, in1, in2, out0, out1, out2) \
|
|
||||||
{ \
|
|
||||||
RTYPE zero = {0}; \
|
|
||||||
\
|
|
||||||
out0 = __msa_add_a_h((v8i16) zero, in0); \
|
|
||||||
out1 = __msa_add_a_h((v8i16) zero, in1); \
|
|
||||||
out2 = __msa_add_a_h((v8i16) zero, in2); \
|
|
||||||
}
|
|
||||||
#define ADD_ABS_H3_SH(...) ADD_ABS_H3(v8i16, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define VSHF_B2(RTYPE, in0, in1, in2, in3, mask0, mask1, out0, out1) \
|
|
||||||
{ \
|
|
||||||
out0 = (RTYPE) __msa_vshf_b((v16i8) mask0, (v16i8) in1, (v16i8) in0); \
|
|
||||||
out1 = (RTYPE) __msa_vshf_b((v16i8) mask1, (v16i8) in3, (v16i8) in2); \
|
|
||||||
}
|
|
||||||
#define VSHF_B2_UB(...) VSHF_B2(v16u8, __VA_ARGS__)
|
|
||||||
|
|
||||||
#define CMP_AND_SELECT(inp0, inp1, inp2, inp3, inp4, inp5, out0) \
|
|
||||||
{ \
|
|
||||||
v8i16 _sel_h0, _sel_h1; \
|
|
||||||
v16u8 _sel_b0, _sel_b1; \
|
|
||||||
_sel_h0 = (v8i16) __msa_clt_u_h((v8u16) inp1, (v8u16) inp0); \
|
|
||||||
_sel_b0 = (v16u8) __msa_pckev_b((v16i8) _sel_h0, (v16i8) _sel_h0); \
|
|
||||||
inp0 = (v8i16) __msa_bmnz_v((v16u8) inp0, (v16u8) inp1, (v16u8) _sel_h0); \
|
|
||||||
inp4 = (v16u8) __msa_bmnz_v(inp3, inp4, _sel_b0); \
|
|
||||||
_sel_h1 = (v8i16) __msa_clt_u_h((v8u16) inp2, (v8u16) inp0); \
|
|
||||||
_sel_b1 = (v16u8) __msa_pckev_b((v16i8) _sel_h1, (v16i8) _sel_h1); \
|
|
||||||
inp4 = (v16u8) __msa_bmnz_v(inp4, inp5, _sel_b1); \
|
|
||||||
out0 += inp4; \
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
size_t i, cnt, cnt16, cnt32;
|
|
||||||
size_t istop = row_info->rowbytes;
|
|
||||||
png_bytep rp = row;
|
|
||||||
png_const_bytep pp = prev_row;
|
|
||||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
|
|
||||||
|
|
||||||
for (i = 0; i < (istop >> 6); i++)
|
|
||||||
{
|
|
||||||
LD_UB4(rp, 16, src0, src1, src2, src3);
|
|
||||||
LD_UB4(pp, 16, src4, src5, src6, src7);
|
|
||||||
pp += 64;
|
|
||||||
|
|
||||||
ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
|
|
||||||
src0, src1, src2, src3);
|
|
||||||
|
|
||||||
ST_UB4(src0, src1, src2, src3, rp, 16);
|
|
||||||
rp += 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (istop & 0x3F)
|
|
||||||
{
|
|
||||||
cnt32 = istop & 0x20;
|
|
||||||
cnt16 = istop & 0x10;
|
|
||||||
cnt = istop & 0xF;
|
|
||||||
|
|
||||||
if(cnt32)
|
|
||||||
{
|
|
||||||
if (cnt16 && cnt)
|
|
||||||
{
|
|
||||||
LD_UB4(rp, 16, src0, src1, src2, src3);
|
|
||||||
LD_UB4(pp, 16, src4, src5, src6, src7);
|
|
||||||
|
|
||||||
ADD4(src0, src4, src1, src5, src2, src6, src3, src7,
|
|
||||||
src0, src1, src2, src3);
|
|
||||||
|
|
||||||
ST_UB4(src0, src1, src2, src3, rp, 16);
|
|
||||||
rp += 64;
|
|
||||||
}
|
|
||||||
else if (cnt16 || cnt)
|
|
||||||
{
|
|
||||||
LD_UB2(rp, 16, src0, src1);
|
|
||||||
LD_UB2(pp, 16, src4, src5);
|
|
||||||
pp += 32;
|
|
||||||
src2 = LD_UB(rp + 32);
|
|
||||||
src6 = LD_UB(pp);
|
|
||||||
|
|
||||||
ADD3(src0, src4, src1, src5, src2, src6, src0, src1, src2);
|
|
||||||
|
|
||||||
ST_UB2(src0, src1, rp, 16);
|
|
||||||
rp += 32;
|
|
||||||
ST_UB(src2, rp);
|
|
||||||
rp += 16;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LD_UB2(rp, 16, src0, src1);
|
|
||||||
LD_UB2(pp, 16, src4, src5);
|
|
||||||
|
|
||||||
ADD2(src0, src4, src1, src5, src0, src1);
|
|
||||||
|
|
||||||
ST_UB2(src0, src1, rp, 16);
|
|
||||||
rp += 32;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (cnt16 && cnt)
|
|
||||||
{
|
|
||||||
LD_UB2(rp, 16, src0, src1);
|
|
||||||
LD_UB2(pp, 16, src4, src5);
|
|
||||||
|
|
||||||
ADD2(src0, src4, src1, src5, src0, src1);
|
|
||||||
|
|
||||||
ST_UB2(src0, src1, rp, 16);
|
|
||||||
rp += 32;
|
|
||||||
}
|
|
||||||
else if (cnt16 || cnt)
|
|
||||||
{
|
|
||||||
src0 = LD_UB(rp);
|
|
||||||
src4 = LD_UB(pp);
|
|
||||||
pp += 16;
|
|
||||||
|
|
||||||
src0 += src4;
|
|
||||||
|
|
||||||
ST_UB(src0, rp);
|
|
||||||
rp += 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_sub4_msa(png_row_infop row_info, png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
size_t count;
|
|
||||||
size_t istop = row_info->rowbytes;
|
|
||||||
png_bytep src = row;
|
|
||||||
png_bytep nxt = row + 4;
|
|
||||||
int32_t inp0;
|
|
||||||
v16u8 src0, src1, src2, src3, src4;
|
|
||||||
v16u8 dst0, dst1;
|
|
||||||
v16u8 zero = { 0 };
|
|
||||||
|
|
||||||
istop -= 4;
|
|
||||||
|
|
||||||
inp0 = LW(src);
|
|
||||||
src += 4;
|
|
||||||
src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
|
|
||||||
|
|
||||||
for (count = 0; count < istop; count += 16)
|
|
||||||
{
|
|
||||||
src1 = LD_UB(src);
|
|
||||||
src += 16;
|
|
||||||
|
|
||||||
src2 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 4);
|
|
||||||
src3 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 8);
|
|
||||||
src4 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 12);
|
|
||||||
src1 += src0;
|
|
||||||
src2 += src1;
|
|
||||||
src3 += src2;
|
|
||||||
src4 += src3;
|
|
||||||
src0 = src4;
|
|
||||||
ILVEV_W2_UB(src1, src2, src3, src4, dst0, dst1);
|
|
||||||
dst0 = (v16u8) __msa_pckev_d((v2i64) dst1, (v2i64) dst0);
|
|
||||||
|
|
||||||
ST_UB(dst0, nxt);
|
|
||||||
nxt += 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_sub3_msa(png_row_infop row_info, png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
size_t count;
|
|
||||||
size_t istop = row_info->rowbytes;
|
|
||||||
png_bytep src = row;
|
|
||||||
png_bytep nxt = row + 3;
|
|
||||||
int64_t out0;
|
|
||||||
int32_t inp0, out1;
|
|
||||||
v16u8 src0, src1, src2, src3, src4, dst0, dst1;
|
|
||||||
v16u8 zero = { 0 };
|
|
||||||
v16i8 mask0 = { 0, 1, 2, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
v16i8 mask1 = { 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
istop -= 3;
|
|
||||||
|
|
||||||
inp0 = LW(src);
|
|
||||||
src += 3;
|
|
||||||
src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
|
|
||||||
|
|
||||||
for (count = 0; count < istop; count += 12)
|
|
||||||
{
|
|
||||||
src1 = LD_UB(src);
|
|
||||||
src += 12;
|
|
||||||
|
|
||||||
src2 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 3);
|
|
||||||
src3 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 6);
|
|
||||||
src4 = (v16u8) __msa_sldi_b((v16i8) zero, (v16i8) src1, 9);
|
|
||||||
src1 += src0;
|
|
||||||
src2 += src1;
|
|
||||||
src3 += src2;
|
|
||||||
src4 += src3;
|
|
||||||
src0 = src4;
|
|
||||||
VSHF_B2_UB(src1, src2, src3, src4, mask0, mask0, dst0, dst1);
|
|
||||||
dst0 = (v16u8) __msa_vshf_b(mask1, (v16i8) dst1, (v16i8) dst0);
|
|
||||||
out0 = __msa_copy_s_d((v2i64) dst0, 0);
|
|
||||||
out1 = __msa_copy_s_w((v4i32) dst0, 2);
|
|
||||||
|
|
||||||
SD(out0, nxt);
|
|
||||||
nxt += 8;
|
|
||||||
SW(out1, nxt);
|
|
||||||
nxt += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_avg4_msa(png_row_infop row_info, png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
png_bytep src = row;
|
|
||||||
png_bytep nxt = row;
|
|
||||||
png_const_bytep pp = prev_row;
|
|
||||||
size_t istop = row_info->rowbytes - 4;
|
|
||||||
int32_t inp0, inp1, out0;
|
|
||||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
|
|
||||||
v16u8 zero = { 0 };
|
|
||||||
|
|
||||||
inp0 = LW(pp);
|
|
||||||
pp += 4;
|
|
||||||
inp1 = LW(src);
|
|
||||||
src += 4;
|
|
||||||
src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
|
|
||||||
src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
|
|
||||||
src0 = (v16u8) MSA_SRLI_B(src0, 1);
|
|
||||||
src1 += src0;
|
|
||||||
out0 = __msa_copy_s_w((v4i32) src1, 0);
|
|
||||||
SW(out0, nxt);
|
|
||||||
nxt += 4;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i += 16)
|
|
||||||
{
|
|
||||||
src2 = LD_UB(pp);
|
|
||||||
pp += 16;
|
|
||||||
src6 = LD_UB(src);
|
|
||||||
src += 16;
|
|
||||||
|
|
||||||
SLDI_B2_0_UB(src2, src6, src3, src7, 4);
|
|
||||||
SLDI_B2_0_UB(src2, src6, src4, src8, 8);
|
|
||||||
SLDI_B2_0_UB(src2, src6, src5, src9, 12);
|
|
||||||
src2 = __msa_ave_u_b(src2, src1);
|
|
||||||
src6 += src2;
|
|
||||||
src3 = __msa_ave_u_b(src3, src6);
|
|
||||||
src7 += src3;
|
|
||||||
src4 = __msa_ave_u_b(src4, src7);
|
|
||||||
src8 += src4;
|
|
||||||
src5 = __msa_ave_u_b(src5, src8);
|
|
||||||
src9 += src5;
|
|
||||||
src1 = src9;
|
|
||||||
ILVEV_W2_UB(src6, src7, src8, src9, dst0, dst1);
|
|
||||||
dst0 = (v16u8) __msa_pckev_d((v2i64) dst1, (v2i64) dst0);
|
|
||||||
|
|
||||||
ST_UB(dst0, nxt);
|
|
||||||
nxt += 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_avg3_msa(png_row_infop row_info, png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
png_bytep src = row;
|
|
||||||
png_bytep nxt = row;
|
|
||||||
png_const_bytep pp = prev_row;
|
|
||||||
size_t istop = row_info->rowbytes - 3;
|
|
||||||
int64_t out0;
|
|
||||||
int32_t inp0, inp1, out1;
|
|
||||||
int16_t out2;
|
|
||||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
|
|
||||||
v16u8 zero = { 0 };
|
|
||||||
v16i8 mask0 = { 0, 1, 2, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
v16i8 mask1 = { 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
inp0 = LW(pp);
|
|
||||||
pp += 3;
|
|
||||||
inp1 = LW(src);
|
|
||||||
src += 3;
|
|
||||||
src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
|
|
||||||
src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
|
|
||||||
src0 = (v16u8) MSA_SRLI_B(src0, 1);
|
|
||||||
src1 += src0;
|
|
||||||
out2 = __msa_copy_s_h((v8i16) src1, 0);
|
|
||||||
SH(out2, nxt);
|
|
||||||
nxt += 2;
|
|
||||||
nxt[0] = src1[2];
|
|
||||||
nxt++;
|
|
||||||
|
|
||||||
for (i = 0; i < istop; i += 12)
|
|
||||||
{
|
|
||||||
src2 = LD_UB(pp);
|
|
||||||
pp += 12;
|
|
||||||
src6 = LD_UB(src);
|
|
||||||
src += 12;
|
|
||||||
|
|
||||||
SLDI_B2_0_UB(src2, src6, src3, src7, 3);
|
|
||||||
SLDI_B2_0_UB(src2, src6, src4, src8, 6);
|
|
||||||
SLDI_B2_0_UB(src2, src6, src5, src9, 9);
|
|
||||||
src2 = __msa_ave_u_b(src2, src1);
|
|
||||||
src6 += src2;
|
|
||||||
src3 = __msa_ave_u_b(src3, src6);
|
|
||||||
src7 += src3;
|
|
||||||
src4 = __msa_ave_u_b(src4, src7);
|
|
||||||
src8 += src4;
|
|
||||||
src5 = __msa_ave_u_b(src5, src8);
|
|
||||||
src9 += src5;
|
|
||||||
src1 = src9;
|
|
||||||
VSHF_B2_UB(src6, src7, src8, src9, mask0, mask0, dst0, dst1);
|
|
||||||
dst0 = (v16u8) __msa_vshf_b(mask1, (v16i8) dst1, (v16i8) dst0);
|
|
||||||
out0 = __msa_copy_s_d((v2i64) dst0, 0);
|
|
||||||
out1 = __msa_copy_s_w((v4i32) dst0, 2);
|
|
||||||
|
|
||||||
SD(out0, nxt);
|
|
||||||
nxt += 8;
|
|
||||||
SW(out1, nxt);
|
|
||||||
nxt += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_paeth4_msa(png_row_infop row_info,
|
|
||||||
png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
int32_t count, rp_end;
|
|
||||||
png_bytep nxt;
|
|
||||||
png_const_bytep prev_nxt;
|
|
||||||
int32_t inp0, inp1, res0;
|
|
||||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9;
|
|
||||||
v16u8 src10, src11, src12, src13, dst0, dst1;
|
|
||||||
v8i16 vec0, vec1, vec2;
|
|
||||||
v16u8 zero = { 0 };
|
|
||||||
|
|
||||||
nxt = row;
|
|
||||||
prev_nxt = prev_row;
|
|
||||||
|
|
||||||
inp0 = LW(nxt);
|
|
||||||
inp1 = LW(prev_nxt);
|
|
||||||
prev_nxt += 4;
|
|
||||||
src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
|
|
||||||
src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
|
|
||||||
|
|
||||||
src1 += src0;
|
|
||||||
res0 = __msa_copy_s_w((v4i32) src1, 0);
|
|
||||||
|
|
||||||
SW(res0, nxt);
|
|
||||||
nxt += 4;
|
|
||||||
|
|
||||||
/* Remainder */
|
|
||||||
rp_end = row_info->rowbytes - 4;
|
|
||||||
|
|
||||||
for (count = 0; count < rp_end; count += 16)
|
|
||||||
{
|
|
||||||
src2 = LD_UB(prev_nxt);
|
|
||||||
prev_nxt += 16;
|
|
||||||
src6 = LD_UB(prev_row);
|
|
||||||
prev_row += 16;
|
|
||||||
src10 = LD_UB(nxt);
|
|
||||||
|
|
||||||
SLDI_B3_0_UB(src2, src6, src10, src3, src7, src11, 4);
|
|
||||||
SLDI_B3_0_UB(src2, src6, src10, src4, src8, src12, 8);
|
|
||||||
SLDI_B3_0_UB(src2, src6, src10, src5, src9, src13, 12);
|
|
||||||
ILVR_B2_SH(src2, src6, src1, src6, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src1, src2, src6, src10);
|
|
||||||
ILVR_B2_SH(src3, src7, src10, src7, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src10, src3, src7, src11);
|
|
||||||
ILVR_B2_SH(src4, src8, src11, src8, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src11, src4, src8, src12);
|
|
||||||
ILVR_B2_SH(src5, src9, src12, src9, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src12, src5, src9, src13);
|
|
||||||
src1 = src13;
|
|
||||||
ILVEV_W2_UB(src10, src11, src12, src1, dst0, dst1);
|
|
||||||
dst0 = (v16u8) __msa_pckev_d((v2i64) dst1, (v2i64) dst0);
|
|
||||||
|
|
||||||
ST_UB(dst0, nxt);
|
|
||||||
nxt += 16;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void png_read_filter_row_paeth3_msa(png_row_infop row_info,
|
|
||||||
png_bytep row,
|
|
||||||
png_const_bytep prev_row)
|
|
||||||
{
|
|
||||||
int32_t count, rp_end;
|
|
||||||
png_bytep nxt;
|
|
||||||
png_const_bytep prev_nxt;
|
|
||||||
int64_t out0;
|
|
||||||
int32_t inp0, inp1, out1;
|
|
||||||
int16_t out2;
|
|
||||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
|
|
||||||
v16u8 src10, src11, src12, src13;
|
|
||||||
v8i16 vec0, vec1, vec2;
|
|
||||||
v16u8 zero = { 0 };
|
|
||||||
v16i8 mask0 = { 0, 1, 2, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
||||||
v16i8 mask1 = { 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 21, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
nxt = row;
|
|
||||||
prev_nxt = prev_row;
|
|
||||||
|
|
||||||
inp0 = LW(nxt);
|
|
||||||
inp1 = LW(prev_nxt);
|
|
||||||
prev_nxt += 3;
|
|
||||||
src0 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp0);
|
|
||||||
src1 = (v16u8) __msa_insert_w((v4i32) zero, 0, inp1);
|
|
||||||
|
|
||||||
src1 += src0;
|
|
||||||
out2 = __msa_copy_s_h((v8i16) src1, 0);
|
|
||||||
|
|
||||||
SH(out2, nxt);
|
|
||||||
nxt += 2;
|
|
||||||
nxt[0] = src1[2];
|
|
||||||
nxt++;
|
|
||||||
|
|
||||||
/* Remainder */
|
|
||||||
rp_end = row_info->rowbytes - 3;
|
|
||||||
|
|
||||||
for (count = 0; count < rp_end; count += 12)
|
|
||||||
{
|
|
||||||
src2 = LD_UB(prev_nxt);
|
|
||||||
prev_nxt += 12;
|
|
||||||
src6 = LD_UB(prev_row);
|
|
||||||
prev_row += 12;
|
|
||||||
src10 = LD_UB(nxt);
|
|
||||||
|
|
||||||
SLDI_B3_0_UB(src2, src6, src10, src3, src7, src11, 3);
|
|
||||||
SLDI_B3_0_UB(src2, src6, src10, src4, src8, src12, 6);
|
|
||||||
SLDI_B3_0_UB(src2, src6, src10, src5, src9, src13, 9);
|
|
||||||
ILVR_B2_SH(src2, src6, src1, src6, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src1, src2, src6, src10);
|
|
||||||
ILVR_B2_SH(src3, src7, src10, src7, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src10, src3, src7, src11);
|
|
||||||
ILVR_B2_SH(src4, src8, src11, src8, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src11, src4, src8, src12);
|
|
||||||
ILVR_B2_SH(src5, src9, src12, src9, vec0, vec1);
|
|
||||||
HSUB_UB2_SH(vec0, vec1, vec0, vec1);
|
|
||||||
vec2 = vec0 + vec1;
|
|
||||||
ADD_ABS_H3_SH(vec0, vec1, vec2, vec0, vec1, vec2);
|
|
||||||
CMP_AND_SELECT(vec0, vec1, vec2, src12, src5, src9, src13);
|
|
||||||
src1 = src13;
|
|
||||||
VSHF_B2_UB(src10, src11, src12, src13, mask0, mask0, dst0, dst1);
|
|
||||||
dst0 = (v16u8) __msa_vshf_b(mask1, (v16i8) dst1, (v16i8) dst0);
|
|
||||||
out0 = __msa_copy_s_d((v2i64) dst0, 0);
|
|
||||||
out1 = __msa_copy_s_w((v4i32) dst0, 2);
|
|
||||||
|
|
||||||
SD(out0, nxt);
|
|
||||||
nxt += 8;
|
|
||||||
SW(out1, nxt);
|
|
||||||
nxt += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
|
||||||
#endif /* PNG_MIPS_MSA_IMPLEMENTATION == 1 (intrinsics) */
|
|
||||||
#endif /* READ */
|
|
||||||
Vendored
-127
@@ -1,127 +0,0 @@
|
|||||||
|
|
||||||
/* mips_init.c - MSA optimised filter functions
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018 Cosmin Truta
|
|
||||||
* Copyright (c) 2016 Glenn Randers-Pehrson
|
|
||||||
* Written by Mandar Sahastrabuddhe, 2016.
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
* For conditions of distribution and use, see the disclaimer
|
|
||||||
* and license in png.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are
|
|
||||||
* called.
|
|
||||||
*/
|
|
||||||
#define _POSIX_SOURCE 1
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "../pngpriv.h"
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
|
|
||||||
#if PNG_MIPS_MSA_OPT > 0
|
|
||||||
#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED /* Do run-time checks */
|
|
||||||
/* WARNING: it is strongly recommended that you do not build libpng with
|
|
||||||
* run-time checks for CPU features if at all possible. In the case of the MIPS
|
|
||||||
* MSA instructions there is no processor-specific way of detecting the
|
|
||||||
* presence of the required support, therefore run-time detection is extremely
|
|
||||||
* OS specific.
|
|
||||||
*
|
|
||||||
* You may set the macro PNG_MIPS_MSA_FILE to the file name of file containing
|
|
||||||
* a fragment of C source code which defines the png_have_msa function. There
|
|
||||||
* are a number of implementations in contrib/mips-msa, but the only one that
|
|
||||||
* has partial support is contrib/mips-msa/linux.c - a generic Linux
|
|
||||||
* implementation which reads /proc/cpufino.
|
|
||||||
*/
|
|
||||||
#ifndef PNG_MIPS_MSA_FILE
|
|
||||||
# ifdef __linux__
|
|
||||||
# define PNG_MIPS_MSA_FILE "contrib/mips-msa/linux.c"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_MIPS_MSA_FILE
|
|
||||||
|
|
||||||
#include <signal.h> /* for sig_atomic_t */
|
|
||||||
static int png_have_msa(png_structp png_ptr);
|
|
||||||
#include PNG_MIPS_MSA_FILE
|
|
||||||
|
|
||||||
#else /* PNG_MIPS_MSA_FILE */
|
|
||||||
# error "PNG_MIPS_MSA_FILE undefined: no support for run-time MIPS MSA checks"
|
|
||||||
#endif /* PNG_MIPS_MSA_FILE */
|
|
||||||
#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
|
|
||||||
|
|
||||||
#ifndef PNG_ALIGNED_MEMORY_SUPPORTED
|
|
||||||
# error "ALIGNED_MEMORY is required; set: -DPNG_ALIGNED_MEMORY_SUPPORTED"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
|
|
||||||
{
|
|
||||||
/* The switch statement is compiled in for MIPS_MSA_API, the call to
|
|
||||||
* png_have_msa is compiled in for MIPS_MSA_CHECK. If both are defined
|
|
||||||
* the check is only performed if the API has not set the MSA option on
|
|
||||||
* or off explicitly. In this case the check controls what happens.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
|
||||||
switch ((pp->options >> PNG_MIPS_MSA) & 3)
|
|
||||||
{
|
|
||||||
case PNG_OPTION_UNSET:
|
|
||||||
/* Allow the run-time check to execute if it has been enabled -
|
|
||||||
* thus both API and CHECK can be turned on. If it isn't supported
|
|
||||||
* this case will fall through to the 'default' below, which just
|
|
||||||
* returns.
|
|
||||||
*/
|
|
||||||
#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
|
|
||||||
{
|
|
||||||
static volatile sig_atomic_t no_msa = -1; /* not checked */
|
|
||||||
|
|
||||||
if (no_msa < 0)
|
|
||||||
no_msa = !png_have_msa(pp);
|
|
||||||
|
|
||||||
if (no_msa)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /* OFF or INVALID */
|
|
||||||
return;
|
|
||||||
|
|
||||||
case PNG_OPTION_ON:
|
|
||||||
/* Option turned on */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* IMPORTANT: any new external functions used here must be declared using
|
|
||||||
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
|
|
||||||
* 'prefix' option to configure works:
|
|
||||||
*
|
|
||||||
* ./configure --with-libpng-prefix=foobar_
|
|
||||||
*
|
|
||||||
* Verify you have got this right by running the above command, doing a build
|
|
||||||
* and examining pngprefix.h; it must contain a #define for every external
|
|
||||||
* function you add. (Notice that this happens automatically for the
|
|
||||||
* initialization function.)
|
|
||||||
*/
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_msa;
|
|
||||||
|
|
||||||
if (bpp == 3)
|
|
||||||
{
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_msa;
|
|
||||||
}
|
|
||||||
else if (bpp == 4)
|
|
||||||
{
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_msa;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void)pp;
|
|
||||||
(void)bpp;
|
|
||||||
#endif /* PNG_MIPS_MSA_API_SUPPORTED */
|
|
||||||
}
|
|
||||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
|
||||||
#endif /* READ */
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
diff --git a/3rdparty/libpng/pngrutil.c b/3rdparty/libpng/pngrutil.c
|
|
||||||
index d5fa08c397..4db3de990b 100644
|
|
||||||
--- a/3rdparty/libpng/pngrutil.c
|
|
||||||
+++ b/3rdparty/libpng/pngrutil.c
|
|
||||||
@@ -2087,10 +2087,8 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (png_crc_finish(png_ptr, 0) != 0)
|
|
||||||
- return;
|
|
||||||
-
|
|
||||||
- png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
|
||||||
+ if (png_crc_finish(png_ptr, 0) == 0)
|
|
||||||
+ png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
|
||||||
|
|
||||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
|
||||||
info_ptr->eXIf_buf = NULL;
|
|
||||||
-53
@@ -1,53 +0,0 @@
|
|||||||
diff --git a/3rdparty/libpng/mips/mips_init.c b/3rdparty/libpng/mips/mips_init.c
|
|
||||||
index 8dd283deef..6a061cccfa 100644
|
|
||||||
--- a/3rdparty/libpng/mips/mips_init.c
|
|
||||||
+++ b/3rdparty/libpng/mips/mips_init.c
|
|
||||||
@@ -73,7 +73,6 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
|
|
||||||
* this case will fall through to the 'default' below, which just
|
|
||||||
* returns.
|
|
||||||
*/
|
|
||||||
-#endif /* PNG_MIPS_MSA_API_SUPPORTED */
|
|
||||||
#ifdef PNG_MIPS_MSA_CHECK_SUPPORTED
|
|
||||||
{
|
|
||||||
static volatile sig_atomic_t no_msa = -1; /* not checked */
|
|
||||||
@@ -84,12 +83,9 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
|
|
||||||
if (no_msa)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
-#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
|
||||||
- break;
|
|
||||||
-#endif
|
|
||||||
#endif /* PNG_MIPS_MSA_CHECK_SUPPORTED */
|
|
||||||
+ break;
|
|
||||||
|
|
||||||
-#ifdef PNG_MIPS_MSA_API_SUPPORTED
|
|
||||||
default: /* OFF or INVALID */
|
|
||||||
return;
|
|
||||||
|
|
||||||
@@ -97,8 +93,6 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
|
|
||||||
/* Option turned on */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
/* IMPORTANT: any new external functions used here must be declared using
|
|
||||||
* PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the
|
|
||||||
* 'prefix' option to configure works:
|
|
||||||
@@ -118,13 +112,16 @@ png_init_filter_functions_msa(png_structp pp, unsigned int bpp)
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_msa;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
else if (bpp == 4)
|
|
||||||
{
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_msa;
|
|
||||||
pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_msa;
|
|
||||||
}
|
|
||||||
+#else
|
|
||||||
+ (void)pp;
|
|
||||||
+ (void)bpp;
|
|
||||||
+#endif /* PNG_MIPS_MSA_API_SUPPORTED */
|
|
||||||
}
|
|
||||||
#endif /* PNG_MIPS_MSA_OPT > 0 */
|
|
||||||
#endif /* READ */
|
|
||||||
Vendored
+6
-5
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_37 Your_png_h_is_not_version_1_6_37;
|
typedef png_libpng_version_1_6_36 Your_png_h_is_not_version_1_6_36;
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
/* The version tests may need to be added to, but the problem warning has
|
/* The version tests may need to be added to, but the problem warning has
|
||||||
@@ -815,8 +815,8 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||||||
return PNG_STRING_COPYRIGHT
|
return PNG_STRING_COPYRIGHT
|
||||||
#else
|
#else
|
||||||
return PNG_STRING_NEWLINE \
|
return PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.6.37" PNG_STRING_NEWLINE \
|
"libpng version 1.6.36" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 2018-2019 Cosmin Truta" PNG_STRING_NEWLINE \
|
"Copyright (c) 2018 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||||
PNG_STRING_NEWLINE \
|
PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
@@ -4588,7 +4588,8 @@ png_image_free(png_imagep image)
|
|||||||
if (image != NULL && image->opaque != NULL &&
|
if (image != NULL && image->opaque != NULL &&
|
||||||
image->opaque->error_buf == NULL)
|
image->opaque->error_buf == NULL)
|
||||||
{
|
{
|
||||||
png_image_free_function(image);
|
/* Ignore errors here: */
|
||||||
|
(void)png_safe_execute(image, png_image_free_function, image);
|
||||||
image->opaque = NULL;
|
image->opaque = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+17
-17
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.37 - April 14, 2019
|
* libpng version 1.6.36 - December 1, 2018
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -14,9 +14,8 @@
|
|||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
* libpng versions 0.97, January 1998, through 1.6.35, July 2018:
|
||||||
* Glenn Randers-Pehrson
|
* Glenn Randers-Pehrson.
|
||||||
* libpng versions 1.6.36, December 2018, through 1.6.37, April 2019:
|
* libpng version 1.6.36, December 1, 2018: Cosmin Truta
|
||||||
* Cosmin Truta
|
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -27,8 +26,8 @@
|
|||||||
* PNG Reference Library License version 2
|
* PNG Reference Library License version 2
|
||||||
* ---------------------------------------
|
* ---------------------------------------
|
||||||
*
|
*
|
||||||
* * Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
* * Copyright (c) 1995-2018 The PNG Reference Library Authors.
|
||||||
* * Copyright (c) 2018-2019 Cosmin Truta.
|
* * Copyright (c) 2018 Cosmin Truta.
|
||||||
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||||
* * Copyright (c) 1996-1997 Andreas Dilger.
|
* * Copyright (c) 1996-1997 Andreas Dilger.
|
||||||
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -36,7 +35,7 @@
|
|||||||
* The software is supplied "as is", without warranty of any kind,
|
* The software is supplied "as is", without warranty of any kind,
|
||||||
* express or implied, including, without limitation, the warranties
|
* express or implied, including, without limitation, the warranties
|
||||||
* of merchantability, fitness for a particular purpose, title, and
|
* of merchantability, fitness for a particular purpose, title, and
|
||||||
* non-infringement. In no event shall the Copyright owners, or
|
* non-infringement. In no even shall the Copyright owners, or
|
||||||
* anyone distributing the software, be liable for any damages or
|
* anyone distributing the software, be liable for any damages or
|
||||||
* other liability, whether in contract, tort or otherwise, arising
|
* other liability, whether in contract, tort or otherwise, arising
|
||||||
* from, out of, or in connection with the software, or the use or
|
* from, out of, or in connection with the software, or the use or
|
||||||
@@ -62,7 +61,7 @@
|
|||||||
* PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
* PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
|
||||||
* -----------------------------------------------------------------------
|
* -----------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
|
* libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
|
||||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
|
||||||
* derived from libpng-1.0.6, and are distributed according to the same
|
* derived from libpng-1.0.6, and are distributed according to the same
|
||||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
@@ -239,7 +238,7 @@
|
|||||||
* ...
|
* ...
|
||||||
* 1.5.30 15 10530 15.so.15.30[.0]
|
* 1.5.30 15 10530 15.so.15.30[.0]
|
||||||
* ...
|
* ...
|
||||||
* 1.6.37 16 10637 16.so.16.37[.0]
|
* 1.6.36 16 10636 16.so.16.36[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major and
|
* Henceforth the source version will match the shared-library major and
|
||||||
* minor numbers; the shared-library major version number will be used for
|
* minor numbers; the shared-library major version number will be used for
|
||||||
@@ -278,8 +277,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.37"
|
#define PNG_LIBPNG_VER_STRING "1.6.36"
|
||||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.37 - April 14, 2019\n"
|
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.36 - December 1, 2018\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
@@ -287,11 +286,12 @@
|
|||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 37
|
#define PNG_LIBPNG_VER_RELEASE 36
|
||||||
|
|
||||||
/* This should be zero for a public release, or non-zero for a
|
/* This should match the numeric part of the final component of
|
||||||
* development version. [Deprecated]
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_BUILD 0
|
#define PNG_LIBPNG_VER_BUILD 0
|
||||||
|
|
||||||
/* Release Status */
|
/* Release Status */
|
||||||
@@ -318,7 +318,7 @@
|
|||||||
* From version 1.0.1 it is:
|
* From version 1.0.1 it is:
|
||||||
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10637 /* 1.6.37 */
|
#define PNG_LIBPNG_VER 10636 /* 1.6.36 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
@@ -428,7 +428,7 @@ extern "C" {
|
|||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_37;
|
typedef char* png_libpng_version_1_6_36;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine-configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.37
|
* libpng version 1.6.36
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|||||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* libpng version 1.6.37 */
|
/* libpng version 1.6.36 */
|
||||||
|
|
||||||
/* Copyright (c) 2018-2019 Cosmin Truta */
|
/* Copyright (c) 2018 Cosmin Truta */
|
||||||
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
/* This code is released under the libpng license. */
|
/* This code is released under the libpng license. */
|
||||||
|
|||||||
Vendored
+5
-5
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngpriv.h - private declarations for use inside libpng
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -2119,11 +2119,11 @@ PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
|
|||||||
|
|
||||||
#if PNG_ARM_NEON_IMPLEMENTATION == 1
|
#if PNG_ARM_NEON_IMPLEMENTATION == 1
|
||||||
PNG_INTERNAL_FUNCTION(void,
|
PNG_INTERNAL_FUNCTION(void,
|
||||||
png_riffle_palette_neon,
|
png_riffle_palette_rgba,
|
||||||
(png_structrp),
|
(png_structrp, png_row_infop),
|
||||||
PNG_EMPTY);
|
PNG_EMPTY);
|
||||||
PNG_INTERNAL_FUNCTION(int,
|
PNG_INTERNAL_FUNCTION(int,
|
||||||
png_do_expand_palette_rgba8_neon,
|
png_do_expand_palette_neon_rgba,
|
||||||
(png_structrp,
|
(png_structrp,
|
||||||
png_row_infop,
|
png_row_infop,
|
||||||
png_const_bytep,
|
png_const_bytep,
|
||||||
@@ -2131,7 +2131,7 @@ PNG_INTERNAL_FUNCTION(int,
|
|||||||
const png_bytepp),
|
const png_bytepp),
|
||||||
PNG_EMPTY);
|
PNG_EMPTY);
|
||||||
PNG_INTERNAL_FUNCTION(int,
|
PNG_INTERNAL_FUNCTION(int,
|
||||||
png_do_expand_palette_rgb8_neon,
|
png_do_expand_palette_neon_rgb,
|
||||||
(png_structrp,
|
(png_structrp,
|
||||||
png_row_infop,
|
png_row_infop,
|
||||||
png_const_bytep,
|
png_const_bytep,
|
||||||
|
|||||||
Vendored
+1
-7
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -994,12 +994,6 @@ png_read_destroy(png_structrp png_ptr)
|
|||||||
png_ptr->chunk_list = NULL;
|
png_ptr->chunk_list = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_EXPAND_SUPPORTED) && \
|
|
||||||
defined(PNG_ARM_NEON_IMPLEMENTATION)
|
|
||||||
png_free(png_ptr, png_ptr->riffled_palette);
|
|
||||||
png_ptr->riffled_palette = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
|
/* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
|
||||||
* callbacks are still set at this point. They are required to complete the
|
* callbacks are still set at this point. They are required to complete the
|
||||||
* destruction of the png_struct itself.
|
* destruction of the png_struct itself.
|
||||||
|
|||||||
Vendored
+23
-25
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -1182,20 +1182,20 @@ png_init_palette_transformations(png_structrp png_ptr)
|
|||||||
png_ptr->palette[png_ptr->background.index].blue;
|
png_ptr->palette[png_ptr->background.index].blue;
|
||||||
|
|
||||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||||
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
||||||
{
|
{
|
||||||
if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
|
if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
|
||||||
{
|
{
|
||||||
/* Invert the alpha channel (in tRNS) unless the pixels are
|
/* Invert the alpha channel (in tRNS) unless the pixels are
|
||||||
* going to be expanded, in which case leave it for later
|
* going to be expanded, in which case leave it for later
|
||||||
*/
|
*/
|
||||||
int i, istop = png_ptr->num_trans;
|
int i, istop = png_ptr->num_trans;
|
||||||
|
|
||||||
for (i = 0; i < istop; i++)
|
for (i=0; i<istop; i++)
|
||||||
png_ptr->trans_alpha[i] =
|
png_ptr->trans_alpha[i] = (png_byte)(255 -
|
||||||
(png_byte)(255 - png_ptr->trans_alpha[i]);
|
png_ptr->trans_alpha[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* READ_INVERT_ALPHA */
|
#endif /* READ_INVERT_ALPHA */
|
||||||
}
|
}
|
||||||
} /* background expand and (therefore) no alpha association. */
|
} /* background expand and (therefore) no alpha association. */
|
||||||
@@ -4320,11 +4320,9 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
|
|||||||
* but sometimes row_info->bit_depth has been changed to 8.
|
* but sometimes row_info->bit_depth has been changed to 8.
|
||||||
* In these cases, the palette hasn't been riffled.
|
* In these cases, the palette hasn't been riffled.
|
||||||
*/
|
*/
|
||||||
i = png_do_expand_palette_rgba8_neon(png_ptr, row_info, row,
|
i = png_do_expand_palette_neon_rgba(png_ptr, row_info, row,
|
||||||
&sp, &dp);
|
&sp, &dp);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
PNG_UNUSED(png_ptr)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (; i < row_width; i++)
|
for (; i < row_width; i++)
|
||||||
@@ -4351,10 +4349,8 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
|
|||||||
dp = row + (size_t)(row_width * 3) - 1;
|
dp = row + (size_t)(row_width * 3) - 1;
|
||||||
i = 0;
|
i = 0;
|
||||||
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
|
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
|
||||||
i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row,
|
i = png_do_expand_palette_neon_rgb(png_ptr, row_info, row,
|
||||||
&sp, &dp);
|
&sp, &dp);
|
||||||
#else
|
|
||||||
PNG_UNUSED(png_ptr)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (; i < row_width; i++)
|
for (; i < row_width; i++)
|
||||||
@@ -4774,17 +4770,19 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
|||||||
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
|
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
|
||||||
if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8))
|
if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8))
|
||||||
{
|
{
|
||||||
|
/* Allocate space for the decompressed full palette. */
|
||||||
if (png_ptr->riffled_palette == NULL)
|
if (png_ptr->riffled_palette == NULL)
|
||||||
{
|
{
|
||||||
/* Initialize the accelerated palette expansion. */
|
png_ptr->riffled_palette = png_malloc(png_ptr, 256*4);
|
||||||
png_ptr->riffled_palette =
|
if (png_ptr->riffled_palette == NULL)
|
||||||
(png_bytep)png_malloc(png_ptr, 256 * 4);
|
png_error(png_ptr, "NULL row buffer");
|
||||||
png_riffle_palette_neon(png_ptr);
|
/* Build the RGBA palette. */
|
||||||
|
png_riffle_palette_rgba(png_ptr, row_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1,
|
png_do_expand_palette(png_ptr, row_info, png_ptr->row_buf + 1,
|
||||||
png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
|
png_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
Vendored
+4
-2
@@ -2087,8 +2087,10 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_crc_finish(png_ptr, 0) == 0)
|
if (png_crc_finish(png_ptr, 0) != 0)
|
||||||
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
return;
|
||||||
|
|
||||||
|
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
||||||
|
|
||||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||||
info_ptr->eXIf_buf = NULL;
|
info_ptr->eXIf_buf = NULL;
|
||||||
|
|||||||
Vendored
+5
-7
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngstruct.h - header file for PNG reference library
|
/* pngstruct.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -228,6 +228,10 @@ struct png_struct_def
|
|||||||
* big_row_buf; while writing it is separately
|
* big_row_buf; while writing it is separately
|
||||||
* allocated.
|
* allocated.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||||
|
/* Buffer to accelerate palette transformations. */
|
||||||
|
png_bytep riffled_palette;
|
||||||
|
#endif
|
||||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||||
png_bytep try_row; /* buffer to save trial row when filtering */
|
png_bytep try_row; /* buffer to save trial row when filtering */
|
||||||
png_bytep tst_row; /* buffer to save best trial row when filtering */
|
png_bytep tst_row; /* buffer to save best trial row when filtering */
|
||||||
@@ -392,12 +396,6 @@ struct png_struct_def
|
|||||||
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
|
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* New member added in libpng-1.6.36 */
|
|
||||||
#if defined(PNG_READ_EXPAND_SUPPORTED) && \
|
|
||||||
defined(PNG_ARM_NEON_IMPLEMENTATION)
|
|
||||||
png_bytep riffled_palette; /* buffer for accelerated palette expansion */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
|
||||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||||
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
||||||
|
|||||||
Vendored
+5
-1
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Copyright (c) 2018-2019 Cosmin Truta
|
* Copyright (c) 2018 Cosmin Truta
|
||||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||||
* Copyright (c) 1996-1997 Andreas Dilger
|
* Copyright (c) 1996-1997 Andreas Dilger
|
||||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
@@ -948,6 +948,10 @@ png_write_destroy(png_structrp png_ptr)
|
|||||||
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
|
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
|
||||||
png_free(png_ptr, png_ptr->row_buf);
|
png_free(png_ptr, png_ptr->row_buf);
|
||||||
png_ptr->row_buf = NULL;
|
png_ptr->row_buf = NULL;
|
||||||
|
#ifdef PNG_READ_EXPANDED_SUPPORTED
|
||||||
|
png_free(png_ptr, png_ptr->riffled_palette);
|
||||||
|
png_ptr->riffled_palette = NULL;
|
||||||
|
#endif
|
||||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||||
png_free(png_ptr, png_ptr->prev_row);
|
png_free(png_ptr, png_ptr->prev_row);
|
||||||
png_free(png_ptr, png_ptr->try_row);
|
png_free(png_ptr, png_ptr->try_row);
|
||||||
|
|||||||
Vendored
-91
@@ -1,91 +0,0 @@
|
|||||||
# COPYRIGHT
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
# or more contributor license agreements. See the NOTICE file
|
|
||||||
# distributed with this work for additional information
|
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
|
||||||
# to you 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) 2020, OPEN AI LAB
|
|
||||||
# Author: qtang@openailab.com or https://github.com/BUG1989
|
|
||||||
# qli@openailab.com
|
|
||||||
# sqfu@openailab.com
|
|
||||||
#
|
|
||||||
|
|
||||||
SET(TENGINE_COMMIT_VERSION "2f3cd86217f3530c8e4a82f3ed5af14c7a4e3943")
|
|
||||||
SET(OCV_TENGINE_DIR "${OpenCV_BINARY_DIR}/3rdparty/libtengine")
|
|
||||||
SET(OCV_TENGINE_SOURCE_PATH "${OCV_TENGINE_DIR}/Tengine-${TENGINE_COMMIT_VERSION}")
|
|
||||||
|
|
||||||
IF(EXISTS "${OCV_TENGINE_SOURCE_PATH}")
|
|
||||||
MESSAGE(STATUS "Tengine is exist already at: ${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
|
|
||||||
|
|
||||||
#MESSAGE(STATUS "**** TENGINE DOWNLOAD BEGIN ****")
|
|
||||||
ocv_download(FILENAME ${OCV_TENGINE_FILENAME}
|
|
||||||
HASH ${tengine_md5sum}
|
|
||||||
URL
|
|
||||||
"${OPENCV_TENGINE_URL}"
|
|
||||||
"$ENV{OPENCV_TENGINE_URL}"
|
|
||||||
"${OCV_TENGINE_URL}"
|
|
||||||
DESTINATION_DIR "${OCV_TENGINE_DIR}"
|
|
||||||
ID TENGINE
|
|
||||||
STATUS res
|
|
||||||
UNPACK RELATIVE_URL)
|
|
||||||
|
|
||||||
if (NOT res)
|
|
||||||
MESSAGE(STATUS "TENGINE DOWNLOAD FAILED. Turning Tengine_FOUND off.")
|
|
||||||
SET(Tengine_FOUND OFF)
|
|
||||||
else ()
|
|
||||||
MESSAGE(STATUS "TENGINE DOWNLOAD success . ")
|
|
||||||
|
|
||||||
SET(Tengine_FOUND ON)
|
|
||||||
SET(BUILD_TENGINE ON)
|
|
||||||
endif()
|
|
||||||
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()
|
|
||||||
# linux system
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
|
|
||||||
SET(CONFIG_ARCH_ARM32 ON)
|
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64) ## AARCH64
|
|
||||||
SET(CONFIG_ARCH_ARM64 ON)
|
|
||||||
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 "")
|
|
||||||
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()
|
|
||||||
endif()
|
|
||||||
Vendored
+6
-8
@@ -126,30 +126,30 @@ endif()
|
|||||||
if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T)
|
if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T)
|
||||||
set(TIFF_SIZE_T "unsigned int")
|
set(TIFF_SIZE_T "unsigned int")
|
||||||
set(TIFF_SIZE_FORMAT "%u")
|
set(TIFF_SIZE_FORMAT "%u")
|
||||||
set(TIFF_SSIZE_T "signed int")
|
|
||||||
set(TIFF_SSIZE_FORMAT "%d")
|
|
||||||
elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
|
elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
|
||||||
set(TIFF_SIZE_T "unsigned long")
|
set(TIFF_SIZE_T "unsigned long")
|
||||||
set(TIFF_SIZE_FORMAT "%lu")
|
set(TIFF_SIZE_FORMAT "%lu")
|
||||||
set(TIFF_SSIZE_T "signed long")
|
|
||||||
set(TIFF_SSIZE_FORMAT "%ld")
|
|
||||||
elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
|
elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
|
||||||
set(TIFF_SIZE_T "unsigned long")
|
set(TIFF_SIZE_T "unsigned long")
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(TIFF_SIZE_FORMAT "%I64u")
|
set(TIFF_SIZE_FORMAT "%I64u")
|
||||||
set(TIFF_SSIZE_FORMAT "%I64d")
|
|
||||||
else()
|
else()
|
||||||
set(TIFF_SIZE_FORMAT "%llu")
|
set(TIFF_SIZE_FORMAT "%llu")
|
||||||
set(TIFF_SSIZE_FORMAT "%lld")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SIZEOF_SIGNED_INT EQUAL SIZEOF_UNSIGNED_CHAR_P)
|
if(SIZEOF_SIGNED_INT EQUAL SIZEOF_UNSIGNED_CHAR_P)
|
||||||
|
set(TIFF_SSIZE_T "signed int")
|
||||||
|
set(TIFF_SSIZE_FORMAT "%d")
|
||||||
elseif(SIZEOF_SIGNED_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
|
elseif(SIZEOF_SIGNED_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
|
||||||
|
set(TIFF_SSIZE_T "signed long")
|
||||||
|
set(TIFF_SSIZE_FORMAT "%ld")
|
||||||
elseif(SIZEOF_SIGNED_LONG_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
|
elseif(SIZEOF_SIGNED_LONG_LONG EQUAL SIZEOF_UNSIGNED_CHAR_P)
|
||||||
set(TIFF_SSIZE_T "signed long long")
|
set(TIFF_SSIZE_T "signed long long")
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
|
set(TIFF_SSIZE_FORMAT "%I64d")
|
||||||
else()
|
else()
|
||||||
|
set(TIFF_SSIZE_FORMAT "%lld")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -216,8 +216,6 @@ endif()
|
|||||||
set(fillorder FILLORDER_MSB2LSB)
|
set(fillorder FILLORDER_MSB2LSB)
|
||||||
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i.*86.*" OR
|
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i.*86.*" OR
|
||||||
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*" OR
|
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*" OR
|
||||||
# AMD64 on Windows
|
|
||||||
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "AMD64" OR
|
|
||||||
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64.*")
|
CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64.*")
|
||||||
set(fillorder FILLORDER_LSB2MSB)
|
set(fillorder FILLORDER_LSB2MSB)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Vendored
-4
@@ -16,11 +16,7 @@ int _TIFF_vsnprintf_f(char* str, size_t size, const char* format, va_list ap)
|
|||||||
int count = -1;
|
int count = -1;
|
||||||
|
|
||||||
if (size != 0)
|
if (size != 0)
|
||||||
#if _MSC_VER <= 1310
|
|
||||||
count = _vsnprintf(str, size, format, ap);
|
|
||||||
#else
|
|
||||||
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
|
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
|
||||||
#endif
|
|
||||||
if (count == -1)
|
if (count == -1)
|
||||||
count = _vscprintf(format, ap);
|
count = _vscprintf(format, ap);
|
||||||
|
|
||||||
|
|||||||
Vendored
-10
@@ -30,7 +30,6 @@
|
|||||||
#include "tiffiop.h"
|
#include "tiffiop.h"
|
||||||
#include "tif_predict.h"
|
#include "tif_predict.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h>
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
_TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where)
|
_TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where)
|
||||||
@@ -358,15 +357,6 @@ _TIFFUInt64ToDouble(uint64 ui64)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float _TIFFClampDoubleToFloat( double val )
|
|
||||||
{
|
|
||||||
if( val > FLT_MAX )
|
|
||||||
return FLT_MAX;
|
|
||||||
if( val < -FLT_MAX )
|
|
||||||
return -FLT_MAX;
|
|
||||||
return (float)val;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _TIFFSeekOK(TIFF* tif, toff_t off)
|
int _TIFFSeekOK(TIFF* tif, toff_t off)
|
||||||
{
|
{
|
||||||
/* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
|
/* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
|
||||||
|
|||||||
+1
-1
@@ -216,7 +216,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||||
#define _FILE_OFFSET_BITS @FILE_OFFSET_BITS@
|
//disabled for OpenCV CMakeLists.txt: #define _FILE_OFFSET_BITS @FILE_OFFSET_BITS@
|
||||||
|
|
||||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||||
|
|||||||
Vendored
+17
-33
@@ -29,6 +29,7 @@
|
|||||||
* (and also some miscellaneous stuff)
|
* (and also some miscellaneous stuff)
|
||||||
*/
|
*/
|
||||||
#include "tiffiop.h"
|
#include "tiffiop.h"
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are used in the backwards compatibility code...
|
* These are used in the backwards compatibility code...
|
||||||
@@ -87,15 +88,13 @@ setDoubleArrayOneValue(double** vpp, double value, size_t nmemb)
|
|||||||
* Install extra samples information.
|
* Install extra samples information.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
setExtraSamples(TIFF* tif, va_list ap, uint32* v)
|
setExtraSamples(TIFFDirectory* td, va_list ap, uint32* v)
|
||||||
{
|
{
|
||||||
/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
|
/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
|
||||||
#define EXTRASAMPLE_COREL_UNASSALPHA 999
|
#define EXTRASAMPLE_COREL_UNASSALPHA 999
|
||||||
|
|
||||||
uint16* va;
|
uint16* va;
|
||||||
uint32 i;
|
uint32 i;
|
||||||
TIFFDirectory* td = &tif->tif_dir;
|
|
||||||
static const char module[] = "setExtraSamples";
|
|
||||||
|
|
||||||
*v = (uint16) va_arg(ap, uint16_vap);
|
*v = (uint16) va_arg(ap, uint16_vap);
|
||||||
if ((uint16) *v > td->td_samplesperpixel)
|
if ((uint16) *v > td->td_samplesperpixel)
|
||||||
@@ -117,18 +116,6 @@ setExtraSamples(TIFF* tif, va_list ap, uint32* v)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( td->td_transferfunction[0] != NULL && (td->td_samplesperpixel - *v > 1) &&
|
|
||||||
!(td->td_samplesperpixel - td->td_extrasamples > 1))
|
|
||||||
{
|
|
||||||
TIFFWarningExt(tif->tif_clientdata,module,
|
|
||||||
"ExtraSamples tag value is changing, "
|
|
||||||
"but TransferFunction was read with a different value. Cancelling it");
|
|
||||||
TIFFClrFieldBit(tif,FIELD_TRANSFERFUNCTION);
|
|
||||||
_TIFFfree(td->td_transferfunction[0]);
|
|
||||||
td->td_transferfunction[0] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
td->td_extrasamples = (uint16) *v;
|
td->td_extrasamples = (uint16) *v;
|
||||||
_TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples);
|
_TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -166,6 +153,15 @@ bad:
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float TIFFClampDoubleToFloat( double val )
|
||||||
|
{
|
||||||
|
if( val > FLT_MAX )
|
||||||
|
return FLT_MAX;
|
||||||
|
if( val < -FLT_MAX )
|
||||||
|
return -FLT_MAX;
|
||||||
|
return (float)val;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
_TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
||||||
{
|
{
|
||||||
@@ -289,18 +285,6 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
_TIFFfree(td->td_smaxsamplevalue);
|
_TIFFfree(td->td_smaxsamplevalue);
|
||||||
td->td_smaxsamplevalue = NULL;
|
td->td_smaxsamplevalue = NULL;
|
||||||
}
|
}
|
||||||
/* Test if 3 transfer functions instead of just one are now needed
|
|
||||||
See http://bugzilla.maptools.org/show_bug.cgi?id=2820 */
|
|
||||||
if( td->td_transferfunction[0] != NULL && (v - td->td_extrasamples > 1) &&
|
|
||||||
!(td->td_samplesperpixel - td->td_extrasamples > 1))
|
|
||||||
{
|
|
||||||
TIFFWarningExt(tif->tif_clientdata,module,
|
|
||||||
"SamplesPerPixel tag value is changing, "
|
|
||||||
"but TransferFunction was read with a different value. Cancelling it");
|
|
||||||
TIFFClrFieldBit(tif,FIELD_TRANSFERFUNCTION);
|
|
||||||
_TIFFfree(td->td_transferfunction[0]);
|
|
||||||
td->td_transferfunction[0] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
td->td_samplesperpixel = (uint16) v;
|
td->td_samplesperpixel = (uint16) v;
|
||||||
break;
|
break;
|
||||||
@@ -336,13 +320,13 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
dblval = va_arg(ap, double);
|
dblval = va_arg(ap, double);
|
||||||
if( dblval < 0 )
|
if( dblval < 0 )
|
||||||
goto badvaluedouble;
|
goto badvaluedouble;
|
||||||
td->td_xresolution = _TIFFClampDoubleToFloat( dblval );
|
td->td_xresolution = TIFFClampDoubleToFloat( dblval );
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_YRESOLUTION:
|
case TIFFTAG_YRESOLUTION:
|
||||||
dblval = va_arg(ap, double);
|
dblval = va_arg(ap, double);
|
||||||
if( dblval < 0 )
|
if( dblval < 0 )
|
||||||
goto badvaluedouble;
|
goto badvaluedouble;
|
||||||
td->td_yresolution = _TIFFClampDoubleToFloat( dblval );
|
td->td_yresolution = TIFFClampDoubleToFloat( dblval );
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_PLANARCONFIG:
|
case TIFFTAG_PLANARCONFIG:
|
||||||
v = (uint16) va_arg(ap, uint16_vap);
|
v = (uint16) va_arg(ap, uint16_vap);
|
||||||
@@ -351,10 +335,10 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
td->td_planarconfig = (uint16) v;
|
td->td_planarconfig = (uint16) v;
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_XPOSITION:
|
case TIFFTAG_XPOSITION:
|
||||||
td->td_xposition = _TIFFClampDoubleToFloat( va_arg(ap, double) );
|
td->td_xposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_YPOSITION:
|
case TIFFTAG_YPOSITION:
|
||||||
td->td_yposition = _TIFFClampDoubleToFloat( va_arg(ap, double) );
|
td->td_yposition = TIFFClampDoubleToFloat( va_arg(ap, double) );
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_RESOLUTIONUNIT:
|
case TIFFTAG_RESOLUTIONUNIT:
|
||||||
v = (uint16) va_arg(ap, uint16_vap);
|
v = (uint16) va_arg(ap, uint16_vap);
|
||||||
@@ -377,7 +361,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
_TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32);
|
_TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32);
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_EXTRASAMPLES:
|
case TIFFTAG_EXTRASAMPLES:
|
||||||
if (!setExtraSamples(tif, ap, &v))
|
if (!setExtraSamples(td, ap, &v))
|
||||||
goto badvalue;
|
goto badvalue;
|
||||||
break;
|
break;
|
||||||
case TIFFTAG_MATTEING:
|
case TIFFTAG_MATTEING:
|
||||||
@@ -700,7 +684,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
case TIFF_SRATIONAL:
|
case TIFF_SRATIONAL:
|
||||||
case TIFF_FLOAT:
|
case TIFF_FLOAT:
|
||||||
{
|
{
|
||||||
float v2 = _TIFFClampDoubleToFloat(va_arg(ap, double));
|
float v2 = TIFFClampDoubleToFloat(va_arg(ap, double));
|
||||||
_TIFFmemcpy(val, &v2, tv_size);
|
_TIFFmemcpy(val, &v2, tv_size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Vendored
+41
-169
@@ -164,7 +164,6 @@ static int TIFFFetchNormalTag(TIFF*, TIFFDirEntry*, int recover);
|
|||||||
static int TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uint64** lpp);
|
static int TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uint64** lpp);
|
||||||
static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);
|
static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);
|
||||||
static void ChopUpSingleUncompressedStrip(TIFF*);
|
static void ChopUpSingleUncompressedStrip(TIFF*);
|
||||||
static void TryChopUpUncompressedBigTiff(TIFF*);
|
|
||||||
static uint64 TIFFReadUInt64(const uint8 *value);
|
static uint64 TIFFReadUInt64(const uint8 *value);
|
||||||
static int _TIFFGetMaxColorChannels(uint16 photometric);
|
static int _TIFFGetMaxColorChannels(uint16 photometric);
|
||||||
|
|
||||||
@@ -4247,19 +4246,6 @@ TIFFReadDirectory(TIFF* tif)
|
|||||||
ChopUpSingleUncompressedStrip(tif);
|
ChopUpSingleUncompressedStrip(tif);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are also uncompressed stripped files with strips larger than */
|
|
||||||
/* 2 GB, which make them unfriendly with a lot of code. If possible, */
|
|
||||||
/* try to expose smaller "virtual" strips. */
|
|
||||||
if( tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
|
|
||||||
tif->tif_dir.td_compression == COMPRESSION_NONE &&
|
|
||||||
(tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP &&
|
|
||||||
TIFFStripSize64(tif) > 0x7FFFFFFFUL )
|
|
||||||
{
|
|
||||||
if ( !_TIFFFillStriles(tif) || !tif->tif_dir.td_stripbytecount )
|
|
||||||
return 0;
|
|
||||||
TryChopUpUncompressedBigTiff(tif);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the dirty directory flag.
|
* Clear the dirty directory flag.
|
||||||
*/
|
*/
|
||||||
@@ -5713,63 +5699,6 @@ TIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void allocChoppedUpStripArrays(TIFF* tif, uint32 nstrips,
|
|
||||||
uint64 stripbytes, uint32 rowsperstrip)
|
|
||||||
{
|
|
||||||
TIFFDirectory *td = &tif->tif_dir;
|
|
||||||
uint64 bytecount;
|
|
||||||
uint64 offset;
|
|
||||||
uint32 i;
|
|
||||||
uint64 *newcounts;
|
|
||||||
uint64 *newoffsets;
|
|
||||||
|
|
||||||
newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
|
|
||||||
"for chopped \"StripByteCounts\" array");
|
|
||||||
newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
|
|
||||||
"for chopped \"StripOffsets\" array");
|
|
||||||
if (newcounts == NULL || newoffsets == NULL) {
|
|
||||||
/*
|
|
||||||
* Unable to allocate new strip information, give up and use
|
|
||||||
* the original one strip information.
|
|
||||||
*/
|
|
||||||
if (newcounts != NULL)
|
|
||||||
_TIFFfree(newcounts);
|
|
||||||
if (newoffsets != NULL)
|
|
||||||
_TIFFfree(newoffsets);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Fill the strip information arrays with new bytecounts and offsets
|
|
||||||
* that reflect the broken-up format.
|
|
||||||
*/
|
|
||||||
offset = td->td_stripoffset[0];
|
|
||||||
bytecount = td->td_stripoffset[td->td_nstrips-1] +
|
|
||||||
td->td_stripbytecount[td->td_nstrips-1] - offset;
|
|
||||||
for (i = 0; i < nstrips; i++)
|
|
||||||
{
|
|
||||||
if (stripbytes > bytecount)
|
|
||||||
stripbytes = bytecount;
|
|
||||||
newcounts[i] = stripbytes;
|
|
||||||
newoffsets[i] = stripbytes ? offset : 0;
|
|
||||||
offset += stripbytes;
|
|
||||||
bytecount -= stripbytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Replace old single strip info with multi-strip info.
|
|
||||||
*/
|
|
||||||
td->td_stripsperimage = td->td_nstrips = nstrips;
|
|
||||||
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
|
|
||||||
|
|
||||||
_TIFFfree(td->td_stripbytecount);
|
|
||||||
_TIFFfree(td->td_stripoffset);
|
|
||||||
td->td_stripbytecount = newcounts;
|
|
||||||
td->td_stripoffset = newoffsets;
|
|
||||||
td->td_stripbytecountsorted = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace a single strip (tile) of uncompressed data by multiple strips
|
* Replace a single strip (tile) of uncompressed data by multiple strips
|
||||||
* (tiles), each approximately STRIP_SIZE_DEFAULT bytes. This is useful for
|
* (tiles), each approximately STRIP_SIZE_DEFAULT bytes. This is useful for
|
||||||
@@ -5785,8 +5714,11 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
|
|||||||
uint32 rowblock;
|
uint32 rowblock;
|
||||||
uint64 rowblockbytes;
|
uint64 rowblockbytes;
|
||||||
uint64 stripbytes;
|
uint64 stripbytes;
|
||||||
|
uint32 strip;
|
||||||
uint32 nstrips;
|
uint32 nstrips;
|
||||||
uint32 rowsperstrip;
|
uint32 rowsperstrip;
|
||||||
|
uint64* newcounts;
|
||||||
|
uint64* newoffsets;
|
||||||
|
|
||||||
bytecount = td->td_stripbytecount[0];
|
bytecount = td->td_stripbytecount[0];
|
||||||
/* On a newly created file, just re-opened to be filled, we */
|
/* On a newly created file, just re-opened to be filled, we */
|
||||||
@@ -5837,106 +5769,46 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
|
newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
|
||||||
|
"for chopped \"StripByteCounts\" array");
|
||||||
|
newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
|
||||||
|
"for chopped \"StripOffsets\" array");
|
||||||
|
if (newcounts == NULL || newoffsets == NULL) {
|
||||||
|
/*
|
||||||
|
* Unable to allocate new strip information, give up and use
|
||||||
|
* the original one strip information.
|
||||||
|
*/
|
||||||
|
if (newcounts != NULL)
|
||||||
|
_TIFFfree(newcounts);
|
||||||
|
if (newoffsets != NULL)
|
||||||
|
_TIFFfree(newoffsets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Fill the strip information arrays with new bytecounts and offsets
|
||||||
|
* that reflect the broken-up format.
|
||||||
|
*/
|
||||||
|
for (strip = 0; strip < nstrips; strip++) {
|
||||||
|
if (stripbytes > bytecount)
|
||||||
|
stripbytes = bytecount;
|
||||||
|
newcounts[strip] = stripbytes;
|
||||||
|
newoffsets[strip] = stripbytes ? offset : 0;
|
||||||
|
offset += stripbytes;
|
||||||
|
bytecount -= stripbytes;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Replace old single strip info with multi-strip info.
|
||||||
|
*/
|
||||||
|
td->td_stripsperimage = td->td_nstrips = nstrips;
|
||||||
|
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
|
||||||
|
|
||||||
|
_TIFFfree(td->td_stripbytecount);
|
||||||
|
_TIFFfree(td->td_stripoffset);
|
||||||
|
td->td_stripbytecount = newcounts;
|
||||||
|
td->td_stripoffset = newoffsets;
|
||||||
|
td->td_stripbytecountsorted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Replace a file with contiguous strips > 2 GB of uncompressed data by
|
|
||||||
* multiple smaller strips. This is useful for
|
|
||||||
* dealing with large images or for dealing with machines with a limited
|
|
||||||
* amount memory.
|
|
||||||
*/
|
|
||||||
static void TryChopUpUncompressedBigTiff( TIFF* tif )
|
|
||||||
{
|
|
||||||
TIFFDirectory *td = &tif->tif_dir;
|
|
||||||
uint32 rowblock;
|
|
||||||
uint64 rowblockbytes;
|
|
||||||
uint32 i;
|
|
||||||
uint64 stripsize;
|
|
||||||
uint32 rowblocksperstrip;
|
|
||||||
uint32 rowsperstrip;
|
|
||||||
uint64 stripbytes;
|
|
||||||
uint32 nstrips;
|
|
||||||
|
|
||||||
stripsize = TIFFStripSize64(tif);
|
|
||||||
|
|
||||||
assert( tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG );
|
|
||||||
assert( tif->tif_dir.td_compression == COMPRESSION_NONE );
|
|
||||||
assert( (tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED)) == TIFF_STRIPCHOP );
|
|
||||||
assert( stripsize > 0x7FFFFFFFUL );
|
|
||||||
|
|
||||||
/* On a newly created file, just re-opened to be filled, we */
|
|
||||||
/* don't want strip chop to trigger as it is going to cause issues */
|
|
||||||
/* later ( StripOffsets and StripByteCounts improperly filled) . */
|
|
||||||
if( td->td_stripbytecount[0] == 0 && tif->tif_mode != O_RDONLY )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ((td->td_photometric == PHOTOMETRIC_YCBCR)&&
|
|
||||||
(!isUpSampled(tif)))
|
|
||||||
rowblock = td->td_ycbcrsubsampling[1];
|
|
||||||
else
|
|
||||||
rowblock = 1;
|
|
||||||
rowblockbytes = TIFFVStripSize64(tif, rowblock);
|
|
||||||
if( rowblockbytes == 0 || rowblockbytes > 0x7FFFFFFFUL )
|
|
||||||
{
|
|
||||||
/* In case of file with gigantic width */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check that the strips are contiguous and of the expected size */
|
|
||||||
for( i = 0; i < td->td_nstrips; i++ )
|
|
||||||
{
|
|
||||||
if( i == td->td_nstrips - 1 )
|
|
||||||
{
|
|
||||||
if( td->td_stripbytecount[i] < TIFFVStripSize64(
|
|
||||||
tif, td->td_imagelength - i * td->td_rowsperstrip ) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( td->td_stripbytecount[i] != stripsize )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if( i > 0 && td->td_stripoffset[i] !=
|
|
||||||
td->td_stripoffset[i-1] + td->td_stripbytecount[i - 1] )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Aim for 512 MB strips (that will still be manageable by 32 bit builds */
|
|
||||||
rowblocksperstrip = (uint32) (512 * 1024 * 1024 / rowblockbytes);
|
|
||||||
if( rowblocksperstrip == 0 )
|
|
||||||
rowblocksperstrip = 1;
|
|
||||||
rowsperstrip = rowblocksperstrip * rowblock;
|
|
||||||
stripbytes = rowblocksperstrip * rowblockbytes;
|
|
||||||
assert( stripbytes <= 0x7FFFFFFFUL );
|
|
||||||
|
|
||||||
nstrips = TIFFhowmany_32(td->td_imagelength, rowsperstrip);
|
|
||||||
if( nstrips == 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* If we are going to allocate a lot of memory, make sure that the */
|
|
||||||
/* file is as big as needed */
|
|
||||||
if( tif->tif_mode == O_RDONLY &&
|
|
||||||
nstrips > 1000000 &&
|
|
||||||
(td->td_stripoffset[td->td_nstrips-1] > TIFFGetFileSize(tif) ||
|
|
||||||
td->td_stripoffset[td->td_nstrips-1] +
|
|
||||||
td->td_stripbytecount[td->td_nstrips-1] > TIFFGetFileSize(tif)) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int _TIFFFillStriles( TIFF *tif )
|
int _TIFFFillStriles( TIFF *tif )
|
||||||
{
|
{
|
||||||
return _TIFFFillStrilesInternal( tif, 1 );
|
return _TIFFFillStrilesInternal( tif, 1 );
|
||||||
|
|||||||
Vendored
+13
-5
@@ -28,6 +28,7 @@
|
|||||||
* Directory Write Support Routines.
|
* Directory Write Support Routines.
|
||||||
*/
|
*/
|
||||||
#include "tiffiop.h"
|
#include "tiffiop.h"
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#ifdef HAVE_IEEEFP
|
#ifdef HAVE_IEEEFP
|
||||||
#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
|
#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
|
||||||
@@ -945,6 +946,15 @@ bad:
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float TIFFClampDoubleToFloat( double val )
|
||||||
|
{
|
||||||
|
if( val > FLT_MAX )
|
||||||
|
return FLT_MAX;
|
||||||
|
if( val < -FLT_MAX )
|
||||||
|
return -FLT_MAX;
|
||||||
|
return (float)val;
|
||||||
|
}
|
||||||
|
|
||||||
static int8 TIFFClampDoubleToInt8( double val )
|
static int8 TIFFClampDoubleToInt8( double val )
|
||||||
{
|
{
|
||||||
if( val > 127 )
|
if( val > 127 )
|
||||||
@@ -1019,7 +1029,7 @@ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di
|
|||||||
if (tif->tif_dir.td_bitspersample<=32)
|
if (tif->tif_dir.td_bitspersample<=32)
|
||||||
{
|
{
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
((float*)conv)[i] = _TIFFClampDoubleToFloat(value[i]);
|
((float*)conv)[i] = TIFFClampDoubleToFloat(value[i]);
|
||||||
ok = TIFFWriteDirectoryTagFloatArray(tif,ndir,dir,tag,count,(float*)conv);
|
ok = TIFFWriteDirectoryTagFloatArray(tif,ndir,dir,tag,count,(float*)conv);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1883,14 +1893,12 @@ TIFFWriteDirectoryTagTransferfunction(TIFF* tif, uint32* ndir, TIFFDirEntry* dir
|
|||||||
n=3;
|
n=3;
|
||||||
if (n==3)
|
if (n==3)
|
||||||
{
|
{
|
||||||
if (tif->tif_dir.td_transferfunction[2] == NULL ||
|
if (!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16)))
|
||||||
!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16)))
|
|
||||||
n=2;
|
n=2;
|
||||||
}
|
}
|
||||||
if (n==2)
|
if (n==2)
|
||||||
{
|
{
|
||||||
if (tif->tif_dir.td_transferfunction[1] == NULL ||
|
if (!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[1],m*sizeof(uint16)))
|
||||||
!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[1],m*sizeof(uint16)))
|
|
||||||
n=1;
|
n=1;
|
||||||
}
|
}
|
||||||
if (n==0)
|
if (n==0)
|
||||||
|
|||||||
Vendored
+3
-8
@@ -742,14 +742,9 @@ LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
|
|||||||
#undef exp2 /* Conflict with C'99 function */
|
#undef exp2 /* Conflict with C'99 function */
|
||||||
#define exp2(x) exp(M_LN2*(x))
|
#define exp2(x) exp(M_LN2*(x))
|
||||||
|
|
||||||
static int itrunc(double x, int m)
|
#define itrunc(x,m) ((m)==SGILOGENCODE_NODITHER ? \
|
||||||
{
|
(int)(x) : \
|
||||||
if( m == SGILOGENCODE_NODITHER )
|
(int)((x) + rand()*(1./RAND_MAX) - .5))
|
||||||
return (int)x;
|
|
||||||
/* Silence CoverityScan warning about bad crypto function */
|
|
||||||
/* coverity[dont_call] */
|
|
||||||
return (int)(x + rand()*(1./RAND_MAX) - .5);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !LOGLUV_PUBLIC
|
#if !LOGLUV_PUBLIC
|
||||||
static
|
static
|
||||||
|
|||||||
Vendored
-2
@@ -247,8 +247,6 @@ LZWSetupDecode(TIFF* tif)
|
|||||||
/*
|
/*
|
||||||
* Zero-out the unused entries
|
* Zero-out the unused entries
|
||||||
*/
|
*/
|
||||||
/* Silence false positive */
|
|
||||||
/* coverity[overrun-buffer-arg] */
|
|
||||||
_TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0,
|
_TIFFmemset(&sp->dec_codetab[CODE_CLEAR], 0,
|
||||||
(CODE_FIRST - CODE_CLEAR) * sizeof (code_t));
|
(CODE_FIRST - CODE_CLEAR) * sizeof (code_t));
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -640,7 +640,6 @@ PixarLogGuessDataFmt(TIFFDirectory *td)
|
|||||||
static tmsize_t
|
static tmsize_t
|
||||||
multiply_ms(tmsize_t m1, tmsize_t m2)
|
multiply_ms(tmsize_t m1, tmsize_t m2)
|
||||||
{
|
{
|
||||||
assert(m1 >= 0 && m2 >= 0);
|
|
||||||
if( m1 == 0 || m2 > TIFF_TMSIZE_T_MAX / m1 )
|
if( m1 == 0 || m2 > TIFF_TMSIZE_T_MAX / m1 )
|
||||||
return 0;
|
return 0;
|
||||||
return m1 * m2;
|
return m1 * m2;
|
||||||
@@ -649,7 +648,6 @@ multiply_ms(tmsize_t m1, tmsize_t m2)
|
|||||||
static tmsize_t
|
static tmsize_t
|
||||||
add_ms(tmsize_t m1, tmsize_t m2)
|
add_ms(tmsize_t m1, tmsize_t m2)
|
||||||
{
|
{
|
||||||
assert(m1 >= 0 && m2 >= 0);
|
|
||||||
/* if either input is zero, assume overflow already occurred */
|
/* if either input is zero, assume overflow already occurred */
|
||||||
if (m1 == 0 || m2 == 0)
|
if (m1 == 0 || m2 == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -819,7 +817,9 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
|
|||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
"Decoding error at scanline %lu, %s",
|
"Decoding error at scanline %lu, %s",
|
||||||
(unsigned long) tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
|
(unsigned long) tif->tif_row, sp->stream.msg ? sp->stream.msg : "(null)");
|
||||||
return (0);
|
if (inflateSync(&sp->stream) != Z_OK)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (state != Z_OK) {
|
if (state != Z_OK) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
|
TIFFErrorExt(tif->tif_clientdata, module, "ZLib error: %s",
|
||||||
|
|||||||
Vendored
+1
-7
@@ -103,11 +103,6 @@ static int TIFFReadAndRealloc( TIFF* tif, tmsize_t size,
|
|||||||
}
|
}
|
||||||
tif->tif_rawdata = new_rawdata;
|
tif->tif_rawdata = new_rawdata;
|
||||||
}
|
}
|
||||||
if( tif->tif_rawdata == NULL )
|
|
||||||
{
|
|
||||||
/* should not happen in practice but helps CoverityScan */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes_read = TIFFReadFile(tif,
|
bytes_read = TIFFReadFile(tif,
|
||||||
tif->tif_rawdata + rawdata_offset + already_read, to_read);
|
tif->tif_rawdata + rawdata_offset + already_read, to_read);
|
||||||
@@ -1372,8 +1367,7 @@ TIFFFillTile(TIFF* tif, uint32 tile)
|
|||||||
tif->tif_rawdataoff = 0;
|
tif->tif_rawdataoff = 0;
|
||||||
tif->tif_rawdataloaded = bytecountm;
|
tif->tif_rawdataloaded = bytecountm;
|
||||||
|
|
||||||
if (tif->tif_rawdata != NULL &&
|
if (!isFillOrder(tif, td->td_fillorder) &&
|
||||||
!isFillOrder(tif, td->td_fillorder) &&
|
|
||||||
(tif->tif_flags & TIFF_NOBITREV) == 0)
|
(tif->tif_flags & TIFF_NOBITREV) == 0)
|
||||||
TIFFReverseBits(tif->tif_rawdata,
|
TIFFReverseBits(tif->tif_rawdata,
|
||||||
tif->tif_rawdataloaded);
|
tif->tif_rawdataloaded);
|
||||||
|
|||||||
Vendored
+17
-28
@@ -349,12 +349,6 @@ TWebPSetupEncode(TIFF* tif)
|
|||||||
|
|
||||||
sp->state |= LSTATE_INIT_ENCODE;
|
sp->state |= LSTATE_INIT_ENCODE;
|
||||||
|
|
||||||
if (!WebPPictureInit(&sp->sPicture)) {
|
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
|
||||||
"Error initializing WebP picture.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WebPConfigInitInternal(&sp->sEncoderConfig, WEBP_PRESET_DEFAULT,
|
if (!WebPConfigInitInternal(&sp->sEncoderConfig, WEBP_PRESET_DEFAULT,
|
||||||
sp->quality_level,
|
sp->quality_level,
|
||||||
WEBP_ENCODER_ABI_VERSION)) {
|
WEBP_ENCODER_ABI_VERSION)) {
|
||||||
@@ -363,13 +357,9 @@ TWebPSetupEncode(TIFF* tif)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebPConfigInitInternal above sets lossless to false
|
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
||||||
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
sp->sEncoderConfig.lossless = sp->lossless;
|
||||||
sp->sEncoderConfig.lossless = sp->lossless;
|
#endif
|
||||||
if (sp->lossless) {
|
|
||||||
sp->sPicture.use_argb = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!WebPValidateConfig(&sp->sEncoderConfig)) {
|
if (!WebPValidateConfig(&sp->sEncoderConfig)) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
@@ -377,6 +367,12 @@ TWebPSetupEncode(TIFF* tif)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WebPPictureInit(&sp->sPicture)) {
|
||||||
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
|
"Error initializing WebP picture.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,12 +415,6 @@ TWebPPreEncode(TIFF* tif, uint16 s)
|
|||||||
/* set up buffer for raw data */
|
/* set up buffer for raw data */
|
||||||
/* given above check and that nSamples <= 4, buffer_size is <= 1 GB */
|
/* given above check and that nSamples <= 4, buffer_size is <= 1 GB */
|
||||||
sp->buffer_size = segment_width * segment_height * sp->nSamples;
|
sp->buffer_size = segment_width * segment_height * sp->nSamples;
|
||||||
|
|
||||||
if (sp->pBuffer != NULL) {
|
|
||||||
_TIFFfree(sp->pBuffer);
|
|
||||||
sp->pBuffer = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
sp->pBuffer = _TIFFmalloc(sp->buffer_size);
|
sp->pBuffer = _TIFFmalloc(sp->buffer_size);
|
||||||
if( !sp->pBuffer) {
|
if( !sp->pBuffer) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module, "Cannot allocate buffer");
|
TIFFErrorExt(tif->tif_clientdata, module, "Cannot allocate buffer");
|
||||||
@@ -470,7 +460,7 @@ TWebPPostEncode(TIFF* tif)
|
|||||||
"WebPPictureImportRGB() failed");
|
"WebPPictureImportRGB() failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WebPEncode(&sp->sEncoderConfig, &sp->sPicture)) {
|
if (!WebPEncode(&sp->sEncoderConfig, &sp->sPicture)) {
|
||||||
|
|
||||||
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
||||||
@@ -550,13 +540,15 @@ TWebPCleanup(TIFF* tif)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sp->pBuffer != NULL) {
|
if (sp->pBuffer != NULL) {
|
||||||
_TIFFfree(sp->pBuffer);
|
_TIFFfree(sp->pBuffer);
|
||||||
sp->pBuffer = NULL;
|
sp->pBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_TIFFfree(tif->tif_data);
|
if (tif->tif_data) {
|
||||||
tif->tif_data = NULL;
|
_TIFFfree(tif->tif_data);
|
||||||
|
tif->tif_data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
_TIFFSetDefaultCompressionState(tif);
|
_TIFFSetDefaultCompressionState(tif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,9 +570,6 @@ TWebPVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
case TIFFTAG_WEBP_LOSSLESS:
|
case TIFFTAG_WEBP_LOSSLESS:
|
||||||
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
#if WEBP_ENCODER_ABI_VERSION >= 0x0100
|
||||||
sp->lossless = va_arg(ap, int);
|
sp->lossless = va_arg(ap, int);
|
||||||
if (sp->lossless){
|
|
||||||
sp->quality_level = 100.0f;
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
|
|||||||
Vendored
+38
-20
@@ -124,6 +124,7 @@ ZIPSetupDecode(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
ZIPPreDecode(TIFF* tif, uint16 s)
|
ZIPPreDecode(TIFF* tif, uint16 s)
|
||||||
{
|
{
|
||||||
|
static const char module[] = "ZIPPreDecode";
|
||||||
ZIPState* sp = DecoderState(tif);
|
ZIPState* sp = DecoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
@@ -137,7 +138,12 @@ ZIPPreDecode(TIFF* tif, uint16 s)
|
|||||||
we need to simplify this code to reflect a ZLib that is likely updated
|
we need to simplify this code to reflect a ZLib that is likely updated
|
||||||
to deal with 8byte memory sizes, though this code will respond
|
to deal with 8byte memory sizes, though this code will respond
|
||||||
appropriately even before we simplify it */
|
appropriately even before we simplify it */
|
||||||
sp->stream.avail_in = (uint64)tif->tif_rawcc < 0xFFFFFFFFU ? (uInt) tif->tif_rawcc : 0xFFFFFFFFU;
|
sp->stream.avail_in = (uInt) tif->tif_rawcc;
|
||||||
|
if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc)
|
||||||
|
{
|
||||||
|
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
return (inflateReset(&sp->stream) == Z_OK);
|
return (inflateReset(&sp->stream) == Z_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,43 +158,46 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
|
|||||||
assert(sp->state == ZSTATE_INIT_DECODE);
|
assert(sp->state == ZSTATE_INIT_DECODE);
|
||||||
|
|
||||||
sp->stream.next_in = tif->tif_rawcp;
|
sp->stream.next_in = tif->tif_rawcp;
|
||||||
|
sp->stream.avail_in = (uInt) tif->tif_rawcc;
|
||||||
|
|
||||||
sp->stream.next_out = op;
|
sp->stream.next_out = op;
|
||||||
assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
|
assert(sizeof(sp->stream.avail_out)==4); /* if this assert gets raised,
|
||||||
we need to simplify this code to reflect a ZLib that is likely updated
|
we need to simplify this code to reflect a ZLib that is likely updated
|
||||||
to deal with 8byte memory sizes, though this code will respond
|
to deal with 8byte memory sizes, though this code will respond
|
||||||
appropriately even before we simplify it */
|
appropriately even before we simplify it */
|
||||||
|
sp->stream.avail_out = (uInt) occ;
|
||||||
|
if ((tmsize_t)sp->stream.avail_out != occ)
|
||||||
|
{
|
||||||
|
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
int state;
|
int state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
|
||||||
uInt avail_in_before = (uint64)tif->tif_rawcc <= 0xFFFFFFFFU ? (uInt)tif->tif_rawcc : 0xFFFFFFFFU;
|
|
||||||
uInt avail_out_before = (uint64)occ < 0xFFFFFFFFU ? (uInt) occ : 0xFFFFFFFFU;
|
|
||||||
sp->stream.avail_in = avail_in_before;
|
|
||||||
sp->stream.avail_out = avail_out_before;
|
|
||||||
state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
|
|
||||||
tif->tif_rawcc -= (avail_in_before - sp->stream.avail_in);
|
|
||||||
occ -= (avail_out_before - sp->stream.avail_out);
|
|
||||||
if (state == Z_STREAM_END)
|
if (state == Z_STREAM_END)
|
||||||
break;
|
break;
|
||||||
if (state == Z_DATA_ERROR) {
|
if (state == Z_DATA_ERROR) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
"Decoding error at scanline %lu, %s",
|
"Decoding error at scanline %lu, %s",
|
||||||
(unsigned long) tif->tif_row, SAFE_MSG(sp));
|
(unsigned long) tif->tif_row, SAFE_MSG(sp));
|
||||||
return (0);
|
if (inflateSync(&sp->stream) != Z_OK)
|
||||||
|
return (0);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (state != Z_OK) {
|
if (state != Z_OK) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
"ZLib error: %s", SAFE_MSG(sp));
|
"ZLib error: %s", SAFE_MSG(sp));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
} while (occ > 0);
|
} while (sp->stream.avail_out > 0);
|
||||||
if (occ != 0) {
|
if (sp->stream.avail_out != 0) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
"Not enough data at scanline %lu (short " TIFF_UINT64_FORMAT " bytes)",
|
"Not enough data at scanline %lu (short " TIFF_UINT64_FORMAT " bytes)",
|
||||||
(unsigned long) tif->tif_row, (TIFF_UINT64_T) occ);
|
(unsigned long) tif->tif_row, (TIFF_UINT64_T) sp->stream.avail_out);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tif->tif_rawcp = sp->stream.next_in;
|
tif->tif_rawcp = sp->stream.next_in;
|
||||||
|
tif->tif_rawcc = sp->stream.avail_in;
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@@ -220,6 +229,7 @@ ZIPSetupEncode(TIFF* tif)
|
|||||||
static int
|
static int
|
||||||
ZIPPreEncode(TIFF* tif, uint16 s)
|
ZIPPreEncode(TIFF* tif, uint16 s)
|
||||||
{
|
{
|
||||||
|
static const char module[] = "ZIPPreEncode";
|
||||||
ZIPState *sp = EncoderState(tif);
|
ZIPState *sp = EncoderState(tif);
|
||||||
|
|
||||||
(void) s;
|
(void) s;
|
||||||
@@ -232,7 +242,12 @@ ZIPPreEncode(TIFF* tif, uint16 s)
|
|||||||
we need to simplify this code to reflect a ZLib that is likely updated
|
we need to simplify this code to reflect a ZLib that is likely updated
|
||||||
to deal with 8byte memory sizes, though this code will respond
|
to deal with 8byte memory sizes, though this code will respond
|
||||||
appropriately even before we simplify it */
|
appropriately even before we simplify it */
|
||||||
sp->stream.avail_out = (uint64)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
|
sp->stream.avail_out = (uInt)tif->tif_rawdatasize;
|
||||||
|
if ((tmsize_t)sp->stream.avail_out != tif->tif_rawdatasize)
|
||||||
|
{
|
||||||
|
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
return (deflateReset(&sp->stream) == Z_OK);
|
return (deflateReset(&sp->stream) == Z_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,9 +269,13 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
|
|||||||
we need to simplify this code to reflect a ZLib that is likely updated
|
we need to simplify this code to reflect a ZLib that is likely updated
|
||||||
to deal with 8byte memory sizes, though this code will respond
|
to deal with 8byte memory sizes, though this code will respond
|
||||||
appropriately even before we simplify it */
|
appropriately even before we simplify it */
|
||||||
|
sp->stream.avail_in = (uInt) cc;
|
||||||
|
if ((tmsize_t)sp->stream.avail_in != cc)
|
||||||
|
{
|
||||||
|
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
uInt avail_in_before = (uint64)cc <= 0xFFFFFFFFU ? (uInt)cc : 0xFFFFFFFFU;
|
|
||||||
sp->stream.avail_in = avail_in_before;
|
|
||||||
if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
|
if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
|
||||||
TIFFErrorExt(tif->tif_clientdata, module,
|
TIFFErrorExt(tif->tif_clientdata, module,
|
||||||
"Encoder error: %s",
|
"Encoder error: %s",
|
||||||
@@ -267,10 +286,9 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
|
|||||||
tif->tif_rawcc = tif->tif_rawdatasize;
|
tif->tif_rawcc = tif->tif_rawdatasize;
|
||||||
TIFFFlushData1(tif);
|
TIFFFlushData1(tif);
|
||||||
sp->stream.next_out = tif->tif_rawdata;
|
sp->stream.next_out = tif->tif_rawdata;
|
||||||
sp->stream.avail_out = (uint64)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
|
sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made already in ZIPPreEncode */
|
||||||
}
|
}
|
||||||
cc -= (avail_in_before - sp->stream.avail_in);
|
} while (sp->stream.avail_in > 0);
|
||||||
} while (cc > 0);
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +314,7 @@ ZIPPostEncode(TIFF* tif)
|
|||||||
tif->tif_rawcc = tif->tif_rawdatasize - sp->stream.avail_out;
|
tif->tif_rawcc = tif->tif_rawdatasize - sp->stream.avail_out;
|
||||||
TIFFFlushData1(tif);
|
TIFFFlushData1(tif);
|
||||||
sp->stream.next_out = tif->tif_rawdata;
|
sp->stream.next_out = tif->tif_rawdata;
|
||||||
sp->stream.avail_out = (uint64)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
|
sp->stream.avail_out = (uInt) tif->tif_rawdatasize; /* this is a safe typecast, as check is made already in ZIPPreEncode */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Vendored
-2
@@ -374,8 +374,6 @@ extern void* _TIFFCheckRealloc(TIFF*, void*, tmsize_t, tmsize_t, const char*);
|
|||||||
extern double _TIFFUInt64ToDouble(uint64);
|
extern double _TIFFUInt64ToDouble(uint64);
|
||||||
extern float _TIFFUInt64ToFloat(uint64);
|
extern float _TIFFUInt64ToFloat(uint64);
|
||||||
|
|
||||||
extern float _TIFFClampDoubleToFloat(double);
|
|
||||||
|
|
||||||
extern tmsize_t
|
extern tmsize_t
|
||||||
_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
|
_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
|
||||||
void **buf, tmsize_t bufsizetoalloc,
|
void **buf, tmsize_t bufsizetoalloc,
|
||||||
|
|||||||
Vendored
-5
@@ -21,11 +21,6 @@ if(ANDROID AND ARMEABI_V7A AND NOT NEON)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# FIX for quant.h - requires C99 for() loops
|
|
||||||
ocv_check_flag_support(C "-std=c99" _varname "${CMAKE_C_FLAGS}")
|
|
||||||
if(${_varname})
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
|
|||||||
Vendored
-30
@@ -1,30 +0,0 @@
|
|||||||
Copyright (c) 2010, Google Inc. All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* 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.
|
|
||||||
|
|
||||||
* Neither the name of Google nor the names of its contributors may
|
|
||||||
be used to endorse or promote products derived from this software
|
|
||||||
without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE 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
|
|
||||||
HOLDER 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.
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
diff --git a/3rdparty/libwebp/src/dsp/msa_macro.h b/3rdparty/libwebp/src/dsp/msa_macro.h
|
|
||||||
index de026a1d9e..a16c0bb300 100644
|
|
||||||
--- a/3rdparty/libwebp/src/dsp/msa_macro.h
|
|
||||||
+++ b/3rdparty/libwebp/src/dsp/msa_macro.h
|
|
||||||
@@ -73,7 +73,7 @@
|
|
||||||
static inline TYPE FUNC_NAME(const void* const psrc) { \
|
|
||||||
const uint8_t* const psrc_m = (const uint8_t*)psrc; \
|
|
||||||
TYPE val_m; \
|
|
||||||
- asm volatile ( \
|
|
||||||
+ __asm__ volatile ( \
|
|
||||||
"" #INSTR " %[val_m], %[psrc_m] \n\t" \
|
|
||||||
: [val_m] "=r" (val_m) \
|
|
||||||
: [psrc_m] "m" (*psrc_m)); \
|
|
||||||
@@ -86,7 +86,7 @@
|
|
||||||
static inline void FUNC_NAME(TYPE val, void* const pdst) { \
|
|
||||||
uint8_t* const pdst_m = (uint8_t*)pdst; \
|
|
||||||
TYPE val_m = val; \
|
|
||||||
- asm volatile ( \
|
|
||||||
+ __asm__ volatile ( \
|
|
||||||
" " #INSTR " %[val_m], %[pdst_m] \n\t" \
|
|
||||||
: [pdst_m] "=m" (*pdst_m) \
|
|
||||||
: [val_m] "r" (val_m)); \
|
|
||||||
+1
-1
@@ -51,4 +51,4 @@ void WebPDeallocateAlphaMemory(VP8Decoder* const dec);
|
|||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // WEBP_DEC_ALPHAI_DEC_H_
|
#endif /* WEBP_DEC_ALPHAI_DEC_H_ */
|
||||||
|
|||||||
+1
-2
@@ -74,8 +74,7 @@ static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) {
|
|||||||
} else { // RGB checks
|
} else { // RGB checks
|
||||||
const WebPRGBABuffer* const buf = &buffer->u.RGBA;
|
const WebPRGBABuffer* const buf = &buffer->u.RGBA;
|
||||||
const int stride = abs(buf->stride);
|
const int stride = abs(buf->stride);
|
||||||
const uint64_t size =
|
const uint64_t size = MIN_BUFFER_SIZE(width, height, stride);
|
||||||
MIN_BUFFER_SIZE(width * kModeBpp[mode], height, stride);
|
|
||||||
ok &= (size <= buf->size);
|
ok &= (size <= buf->size);
|
||||||
ok &= (stride >= width * kModeBpp[mode]);
|
ok &= (stride >= width * kModeBpp[mode]);
|
||||||
ok &= (buf->rgba != NULL);
|
ok &= (buf->rgba != NULL);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user