mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Compare commits
1156 Commits
3.4.6
...
4.1.1-openvino
| Author | SHA1 | Date | |
|---|---|---|---|
| 693877212d | |||
| d7744aca02 | |||
| db211446f3 | |||
| 43eba3d750 | |||
| ad49138fae | |||
| 3200fe0e53 | |||
| 82e5b961d3 | |||
| e00b0f6f47 | |||
| 6dfe2ddc21 | |||
| fee87c5fdb | |||
| 07fe1cd6b8 | |||
| ac14cee71c | |||
| f795878d1a | |||
| bc95c609ff | |||
| ca022fdb4c | |||
| 206b546e5a | |||
| 097d81363b | |||
| 2370079220 | |||
| 02936dcf86 | |||
| ff877af2af | |||
| 9a24886282 | |||
| 350532ea2c | |||
| 3b8701e97e | |||
| a37201abee | |||
| e3e8a58799 | |||
| 275579a835 | |||
| 2bf8793632 | |||
| db6a6ccaba | |||
| 69560588fe | |||
| edf2cbd5f7 | |||
| b00e19a8da | |||
| 6dea8309c5 | |||
| 9befb7a1d7 | |||
| bff90d4684 | |||
| 44836c7f78 | |||
| 65552bf403 | |||
| 3e4a195b61 | |||
| 915427621f | |||
| e9a2e665b2 | |||
| 6fdce865b8 | |||
| 25d62cc929 | |||
| 93ef27aeba | |||
| a04ab2298b | |||
| 43e457c883 | |||
| bc79f477dd | |||
| e3aa96ccf2 | |||
| 453466eb1a | |||
| 49805f976a | |||
| 1666195984 | |||
| 3d345ca4c4 | |||
| 8dd596b7ba | |||
| 0a45b8c478 | |||
| 75f4c1abf2 | |||
| e10c01047c | |||
| 719912e46e | |||
| 75c567b6ab | |||
| 8937e8756e | |||
| a743de0e24 | |||
| c531e275cc | |||
| e59c6caee5 | |||
| 54fc60eb37 | |||
| 031e57b359 | |||
| 96a2f80bf2 | |||
| f2f600f807 | |||
| b95e93c20a | |||
| 24790e4061 | |||
| c251915198 | |||
| 4112866821 | |||
| 5b521bb778 | |||
| 3cfd8cc1fe | |||
| 411ca87a86 | |||
| 2172544bb7 | |||
| df7049d465 | |||
| 01a41d86bc | |||
| 0a461e7922 | |||
| daa308f81c | |||
| 333e51b217 | |||
| 8fd87033ef | |||
| 44d146af9a | |||
| f3e9eb3371 | |||
| 63e4b35c19 | |||
| e8a703a71d | |||
| 9b9e04a061 | |||
| 4a6888ccf6 | |||
| e755c66418 | |||
| b58b2c5ae8 | |||
| e8ff5cac1d | |||
| de60600126 | |||
| d17d3b66aa | |||
| f4ca2c8e72 | |||
| 46205a7235 | |||
| 5620306c70 | |||
| e8283f94ed | |||
| 894f208de3 | |||
| f8c96cb18a | |||
| e72f451173 | |||
| 5c63be3c6e | |||
| 974491f93d | |||
| e21f89a16d | |||
| 16294437d5 | |||
| d75a089690 | |||
| 442bc80cd7 | |||
| f84b08ff08 | |||
| f33f88de31 | |||
| 4b205680df | |||
| 779f59da6b | |||
| f5ddaef46b | |||
| aa6c66aa54 | |||
| e69ff71302 | |||
| 6b32bd5f15 | |||
| 2b2633c11f | |||
| 31a22c27fe | |||
| 0ae053fdf8 | |||
| d8c5bd92ae | |||
| 2a67375239 | |||
| 5ac55fc132 | |||
| 729848caeb | |||
| 13a782c039 | |||
| 8ab6efb8c0 | |||
| ab24325df3 | |||
| 681e0323f2 | |||
| baf372ad3d | |||
| 9cb239247d | |||
| 1b7b2c3a62 | |||
| 7c0a9ff4c1 | |||
| 95d9cfb5c3 | |||
| 8d75bfae47 | |||
| 1d2ef6b2a1 | |||
| 264679a725 | |||
| 7f9a9f2a09 | |||
| 26dfa5e77c | |||
| 7b099e0fe2 | |||
| bb7dc5f992 | |||
| 66d7956e67 | |||
| 1f519eea89 | |||
| b8c080de12 | |||
| b6e41ebf27 | |||
| ba0ed79635 | |||
| 8ca4252303 | |||
| b909df5531 | |||
| 3df83dce7e | |||
| 3697ebef47 | |||
| 549c53121a | |||
| dfdc91f8c9 | |||
| d3c0f4ef98 | |||
| eba696a41e | |||
| 54a14c877c | |||
| cf9bddcb89 | |||
| fc0498b5bd | |||
| 3af1b6ecdc | |||
| 4623e6220f | |||
| a29e59a770 | |||
| ae31115017 | |||
| f9eab2de5e | |||
| e9ed7eb68d | |||
| 6389303c1c | |||
| 5015829ce8 | |||
| 3f5c85e933 | |||
| 6aab6a251c | |||
| 81fad9e247 | |||
| 1c661e7548 | |||
| a457fbdb58 | |||
| e7dbc4ff28 | |||
| d2aadabc5e | |||
| f8791f072d | |||
| db7f689728 | |||
| b4d3ff378e | |||
| 6c8ffe81d0 | |||
| 1706a7609a | |||
| b3e6c97d98 | |||
| d60ac98ef2 | |||
| 10d61a2b44 | |||
| 3f67623c26 | |||
| 59f4a2e0f3 | |||
| d3d13c41c4 | |||
| f6230ae019 | |||
| 11b020b9f9 | |||
| 878af7ada8 | |||
| 987061d800 | |||
| f99f58d99f | |||
| 1aefa6779f | |||
| d2f9cfcf81 | |||
| 52644f067e | |||
| 417ac94456 | |||
| 02bfd20760 | |||
| 6d916c5bb4 | |||
| 1e9ad5476d | |||
| 5e80191d27 | |||
| 058367f34c | |||
| ddcf388270 | |||
| 254f88f805 | |||
| 60fb1fde75 | |||
| 00367289bd | |||
| a9769b9202 | |||
| 6d62be55b3 | |||
| 002925466b | |||
| 8fae361768 | |||
| 65919ed839 | |||
| cdee3d33b4 | |||
| f5ca9d3fe1 | |||
| 4a8fd71a2e | |||
| 1e6e18ff05 | |||
| 5c05b7bc01 | |||
| a51d46cbf9 | |||
| c6deba6003 | |||
| 08019732e2 | |||
| aab9ef4290 | |||
| 03382d29cc | |||
| 3833d86f0f | |||
| 94ec0e9b74 | |||
| e8e020ffb7 | |||
| e9b8571afc | |||
| f3de2b4be7 | |||
| 51631b90af | |||
| a2445c44cb | |||
| 5c56b8ce92 | |||
| 1aca1d582e | |||
| 3efd2df87f | |||
| f1fb002682 | |||
| d5a0d6783a | |||
| 5fde16ba90 | |||
| 394bc91e07 | |||
| edb3337ead | |||
| 25e4bce1a6 | |||
| fa96507fe7 | |||
| e329c84d5e | |||
| 1febb12942 | |||
| 03a3be0844 | |||
| 9802b4e123 | |||
| e1ef7a2288 | |||
| f768f89803 | |||
| 1f75c67c56 | |||
| f1b6228d4f | |||
| d58f9ae824 | |||
| 76fca0e755 | |||
| a38157a1f4 | |||
| f355b3505f | |||
| 3b015dfc7d | |||
| 0ec72cbd10 | |||
| 68e220e7bb | |||
| 143b3d2b5b | |||
| e96c94c4e4 | |||
| 9c0af1f675 | |||
| db900af8c7 | |||
| 9fd95b93f7 | |||
| ae279966c2 | |||
| 3289a0aff9 | |||
| 723165f878 | |||
| 805ab6331f | |||
| 738435b1dd | |||
| d8b42792a6 | |||
| f94253b82b | |||
| 3ccb1d67c2 | |||
| 8ea2f59d33 | |||
| d6d4571628 | |||
| 43de95eb19 | |||
| 0ecc2b8c17 | |||
| 52548bde05 | |||
| d2d8535a31 | |||
| 29b3f66507 | |||
| 419a6d51b3 | |||
| 081d9bc73f | |||
| 9f68376c91 | |||
| 216988b0b1 | |||
| 53c771551c | |||
| 43467a2ac7 | |||
| 0d477d7364 | |||
| e0d88cb7a4 | |||
| 571dfa7605 | |||
| ca8a1d2cff | |||
| 38a3c1ce6b | |||
| a3be8d7cd7 | |||
| 483e9f341c | |||
| aaf56c2839 | |||
| ed96864892 | |||
| 05563f5bc4 | |||
| 61d3222a22 | |||
| a81c0e6db9 | |||
| d73261844e | |||
| b07f951e6b | |||
| 42484f3bcb | |||
| d7c465d49e | |||
| c5204a74c0 | |||
| 4a2544ff4b | |||
| c9b3e718db | |||
| 44d21e5a79 | |||
| 8c698262ea | |||
| 1094ed64e9 | |||
| 791ebd05fc | |||
| 483f28723c | |||
| a550e50683 | |||
| 472f3b7347 | |||
| d1615ba11a | |||
| 898cf70210 | |||
| b958498074 | |||
| 171dd9eff5 | |||
| 6c6dd16acf | |||
| a6144b8e1a | |||
| e07ffe902e | |||
| 9b130efbb3 | |||
| 22701f0c27 | |||
| f0fb91f2d4 | |||
| f9564e053d | |||
| 166ecaeda8 | |||
| 2acc7c96e7 | |||
| 1810702bf0 | |||
| 96e2126ade | |||
| fb9c083a51 | |||
| dc28a1aba2 | |||
| 2080e06f7b | |||
| f3319f6140 | |||
| 1050b5351e | |||
| def8fa2248 | |||
| 2fd1a4eef7 | |||
| 8bf9dda604 | |||
| 54ff72a1cc | |||
| cbb699efd2 | |||
| d9dac9cd1b | |||
| fff7b7e459 | |||
| bcf7286ad9 | |||
| 7ed858e38e | |||
| 935c02c0a3 | |||
| f629cdfe2c | |||
| 26e426adb1 | |||
| 190467b6c1 | |||
| eb243847eb | |||
| de977cc9c8 | |||
| a433394870 | |||
| e90e0ef9aa | |||
| bc4b2d521c | |||
| f0f50b757d | |||
| 33cb9c5ca5 | |||
| e4b9a58c15 | |||
| 3c1267dbe6 | |||
| 132253c9f3 | |||
| 9340af1a8a | |||
| 447116a93c | |||
| d848594deb | |||
| b4ec8fe3ef | |||
| 6fc6207e93 | |||
| dbc7faca46 | |||
| b5e2ec4ea4 | |||
| 7b4aefedea | |||
| 30a595789c | |||
| 9003b60d65 | |||
| d93588dfeb | |||
| 6ca3c7f59f | |||
| e21262deba | |||
| 84fd8190f3 | |||
| 7a55f2af3b | |||
| 88996323b6 | |||
| 8b192b76c0 | |||
| 962d57b4d6 | |||
| 18151e79bb | |||
| a70e1eecd9 | |||
| 3e876c5066 | |||
| 6bff0e24f8 | |||
| b8f9076de0 | |||
| 47c45e5bd3 | |||
| 8936a0f3a5 | |||
| d784b40e24 | |||
| 68012bfbf9 | |||
| 9fabc3406f | |||
| e7338024f6 | |||
| 63bb97cc19 | |||
| 1220dd4877 | |||
| 96ab78dc4f | |||
| 50af4df1d7 | |||
| 3201ea89d6 | |||
| dfa753c6b4 | |||
| 6389dfe49c | |||
| dadb1473c1 | |||
| c3b0a68a2b | |||
| f024425dd0 | |||
| 1b294c013a | |||
| b2abd8ca41 | |||
| b998c06d08 | |||
| 5ba8aa781c | |||
| 455323ed58 | |||
| eb161942de | |||
| fa8e301c69 | |||
| 2aed9aea47 | |||
| 55c02ff628 | |||
| 9a81ff7315 | |||
| c2e26c1527 | |||
| 5acfa524cb | |||
| 94c7d99d0d | |||
| 471b83ccd5 | |||
| 7bb8d89ef3 | |||
| 6b6222bfbb | |||
| 5a77f4cee3 | |||
| adc1ef9308 | |||
| 610f5481c1 | |||
| 03ec1ca0a4 | |||
| 04caf0549d | |||
| 0e1dd63f5e | |||
| fc57129300 | |||
| b7ca3d77a6 | |||
| ceff82877d | |||
| 1aff378ae8 | |||
| e28e3c9491 | |||
| 163d5e4d39 | |||
| bc9893799d | |||
| 076ee65c85 | |||
| 1c092a181d | |||
| a6ed8f268a | |||
| ddfaa41f07 | |||
| 834d438d6e | |||
| 77fa59c3da | |||
| 3bcbd2a078 | |||
| 85ea37ac01 | |||
| dac31e84fb | |||
| 138a80611c | |||
| 2da00161c5 | |||
| f5801ee7da | |||
| 9408c3e640 | |||
| 1c180f4c7f | |||
| cd4926778e | |||
| 38c0278be3 | |||
| ffd4a27901 | |||
| 683acd9ae2 | |||
| faca45a7ea | |||
| 643d9df42d | |||
| 84847cf4c3 | |||
| 61b928d9bd | |||
| e8a626d43a | |||
| 025f679dbc | |||
| afb157df67 | |||
| 82be2d6210 | |||
| e8ac7a34dd | |||
| b95fdc1992 | |||
| d17699363c | |||
| 90c34c5c17 | |||
| c9f3f4d1d3 | |||
| 7b8ce63730 | |||
| ffaf4d5da4 | |||
| fb326a3589 | |||
| f81886d17c | |||
| 0023d8a106 | |||
| 4f6be11c0e | |||
| a164a131f9 | |||
| 0431ecb9e2 | |||
| 18d10d6b86 | |||
| cd879bedb4 | |||
| 45ced8e022 | |||
| 520e351489 | |||
| 2f7fc1a598 | |||
| ec39f0dc9e | |||
| e98222dfb3 | |||
| 3b3347857f | |||
| 7d2190a5d4 | |||
| c1981f28ad | |||
| d0032b0717 | |||
| 8eb685de9d | |||
| 9bfaf4fe40 | |||
| 8120595c3e | |||
| de4be8e610 | |||
| 0bbd28e0d4 | |||
| 8fac166b66 | |||
| 5c404bb142 | |||
| 9b635830bc | |||
| 319e891d7d | |||
| 44bd849697 | |||
| 4a54aa3fbd | |||
| 3f9343e238 | |||
| 8af96248bf | |||
| f7856a0f35 | |||
| f439fc4306 | |||
| 25247b9f6e | |||
| 5c0a98cfb6 | |||
| 269c28e69e | |||
| a5c92c2029 | |||
| c024edb9a8 | |||
| 3abae3c511 | |||
| 2e4d771005 | |||
| 4f764b812e | |||
| f7b6e30156 | |||
| 9dccfe2a96 | |||
| 2b84039a16 | |||
| 96610c7ee1 | |||
| 1f517b8a02 | |||
| 52f16e0f55 | |||
| dedd966002 | |||
| 6d3ae8d4ca | |||
| c667de9b68 | |||
| 621e3eaed8 | |||
| 3ef046b6c9 | |||
| 74d5cdb6d8 | |||
| 7ad5d21900 | |||
| ebe13a9613 | |||
| 7c1d9fea8b | |||
| 59e4f85898 | |||
| a304069687 | |||
| 62d079fa69 | |||
| 3902694075 | |||
| 00861b668a | |||
| 0d747daf47 | |||
| 78384d8923 | |||
| a56c12278e | |||
| c9a76ede94 | |||
| 246733382f | |||
| d1387b25eb | |||
| 86561fef90 | |||
| 64fd1c95a5 | |||
| 4635356435 | |||
| ef16e4203e | |||
| 92cbec6fb1 | |||
| 0cfd95c097 | |||
| 169dc9c311 | |||
| 60a841c797 | |||
| a246d8d8e9 | |||
| 64629cb94e | |||
| 9515137cb2 | |||
| 5f500692f1 | |||
| 227ec19929 | |||
| a2bbfa1db5 | |||
| a9ddf12187 | |||
| d68e722b71 | |||
| 5cb0eded64 | |||
| 39630e076a | |||
| 7621b91769 | |||
| c8056b3e27 | |||
| a0a1fb5fec | |||
| 15bb0b86ce | |||
| 7ce2397b62 | |||
| e0841f3d6e | |||
| b38de57f9a | |||
| 64168fc20a | |||
| 072b524e02 | |||
| 371bba8f54 | |||
| 2eaf35eb63 | |||
| 0b9d53829f | |||
| dad2247b56 | |||
| 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 | |||
| e0b664f390 | |||
| a534af68b8 | |||
| 6e2ede8c56 | |||
| 8c0b0714e7 | |||
| 55f02d8c66 | |||
| 49093d6d38 | |||
| d71977b4dd | |||
| a1ef612662 | |||
| 4f9a99141e | |||
| 713d91b04e | |||
| 332c37f332 | |||
| b46fa2e556 | |||
| 25a9a32f8e | |||
| 11fd9e5fdc | |||
| 403f11fdbf | |||
| b4cba524d3 | |||
| 746cd1e1e6 | |||
| 19cf511895 | |||
| 6b31f58092 | |||
| 7444f0c651 | |||
| dd37c10d4a | |||
| dd262b7087 | |||
| 65e76adeda | |||
| 3d1dbd2ccd | |||
| 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 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.
|
||||
-->
|
||||
|
||||
@@ -27,4 +35,4 @@ This is a template helping you to create an issue which can be processed as quic
|
||||
// C++ code example
|
||||
```
|
||||
or attach as .txt or .zip file
|
||||
-->
|
||||
-->
|
||||
|
||||
Vendored
+2
@@ -12,6 +12,8 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64.*|AARCH64.*")
|
||||
set(AARCH64 TRUE)
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-function)
|
||||
|
||||
set(TEGRA_COMPILER_FLAGS "")
|
||||
|
||||
if(CV_GCC OR CV_CLANG)
|
||||
|
||||
+4
-4
@@ -49,12 +49,12 @@ namespace {
|
||||
|
||||
enum
|
||||
{
|
||||
SHIFT = 14,
|
||||
SHIFT = 15,
|
||||
SHIFT_DELTA = 1 << (SHIFT - 1),
|
||||
|
||||
R2Y_BT601 = 4899,
|
||||
G2Y_BT601 = 9617,
|
||||
B2Y_BT601 = 1868,
|
||||
R2Y_BT601 = 9798,
|
||||
G2Y_BT601 = 19235,
|
||||
B2Y_BT601 = 3735,
|
||||
|
||||
R2Y_BT709 = 3483,
|
||||
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>::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 ||
|
||||
(std::numeric_limits<T>::is_integer &&
|
||||
(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>::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 ||
|
||||
(std::numeric_limits<T>::is_integer &&
|
||||
scale < 1.0f &&
|
||||
@@ -463,8 +471,6 @@ void div(const Size2D &size,
|
||||
return;
|
||||
}
|
||||
|
||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
||||
|
||||
size_t roiw128 = size.width >= 3 ? size.width - 3 : 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_src1 = vld1q_f32(src1 + j);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(vmulq_f32(v_src0, internal::vrecpq_f32(v_src1))), v_mask)));
|
||||
vst1q_f32(dst + j, vmulq_f32(v_src0, internal::vrecpq_f32(v_src1)));
|
||||
}
|
||||
|
||||
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_src1 = vld1_f32(src1 + j);
|
||||
|
||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(vmul_f32(v_src0, internal::vrecp_f32(v_src1))), v_mask)));
|
||||
vst1_f32(dst + j, vmul_f32(v_src0, internal::vrecp_f32(v_src1)));
|
||||
}
|
||||
|
||||
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_src1 = vld1q_f32(src1 + j);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(vmulq_f32(vmulq_n_f32(v_src0, scale),
|
||||
internal::vrecpq_f32(v_src1))), v_mask)));
|
||||
vst1q_f32(dst + j, vmulq_f32(vmulq_n_f32(v_src0, scale),
|
||||
internal::vrecpq_f32(v_src1)));
|
||||
}
|
||||
|
||||
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_src1 = vld1_f32(src1 + j);
|
||||
|
||||
uint32x2_t v_mask = vceq_f32(v_src1,vget_low_f32(v_zero));
|
||||
vst1_f32(dst + j, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(vmul_f32(vmul_n_f32(v_src0, scale),
|
||||
internal::vrecp_f32(v_src1))), v_mask)));
|
||||
vst1_f32(dst + j, vmul_f32(vmul_n_f32(v_src0, scale),
|
||||
internal::vrecp_f32(v_src1)));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
float32x4_t v_zero = vdupq_n_f32(0.0f);
|
||||
|
||||
size_t roiw128 = size.width >= 3 ? size.width - 3 : 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);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(internal::vrecpq_f32(v_src1)), v_mask)));
|
||||
vst1q_f32(dst + j, internal::vrecpq_f32(v_src1));
|
||||
}
|
||||
|
||||
for (; j < roiw64; j += 2)
|
||||
{
|
||||
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, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(internal::vrecp_f32(v_src1)), v_mask)));
|
||||
vst1_f32(dst + j, internal::vrecp_f32(v_src1));
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
uint32x4_t v_mask = vceqq_f32(v_src1,v_zero);
|
||||
vst1q_f32(dst + j, vreinterpretq_f32_u32(vbicq_u32(
|
||||
vreinterpretq_u32_f32(vmulq_n_f32(internal::vrecpq_f32(v_src1),
|
||||
scale)),v_mask)));
|
||||
vst1q_f32(dst + j, vmulq_n_f32(internal::vrecpq_f32(v_src1), scale));
|
||||
}
|
||||
|
||||
for (; j < roiw64; j += 2)
|
||||
{
|
||||
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, vreinterpret_f32_u32(vbic_u32(
|
||||
vreinterpret_u32_f32(vmul_n_f32(internal::vrecp_f32(v_src1),
|
||||
scale)), v_mask)));
|
||||
vst1_f32(dst + j, vmul_n_f32(internal::vrecp_f32(v_src1), scale));
|
||||
}
|
||||
|
||||
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 <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
$url = "https://raw.githubusercontent.com/opencv/opencv_3rdparty/@FFMPEG_BINARIES_COMMIT@/ffmpeg/opencv_ffmpeg_64.dll"
|
||||
$url = "https://raw.githubusercontent.com/opencv/opencv_3rdparty/@FFMPEG_BINARIES_COMMIT@/ffmpeg/opencv_videoio_ffmpeg_64.dll"
|
||||
$expected_md5 = "@FFMPEG_FILE_HASH_BIN64@"
|
||||
$output = "$PSScriptRoot\@OPENCV_BIN_INSTALL_PATH@\opencv_ffmpeg@OPENCV_DLLVERSION@_64.dll"
|
||||
$output = "$PSScriptRoot\@OPENCV_BIN_INSTALL_PATH@\opencv_videoio_ffmpeg@OPENCV_DLLVERSION@_64.dll"
|
||||
|
||||
Write-Output ("=" * 120)
|
||||
try {
|
||||
|
||||
Vendored
+8
-8
@@ -1,16 +1,16 @@
|
||||
# Binaries branch name: ffmpeg/3.4_20181103
|
||||
# Binaries were created for OpenCV: c6d2f0399a706028f476f3d08358ea787503020d
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "fe71c0ad807fdc33c2178e48e488f1e9b177c39a")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "41b81bb9a50cabd4bea385f7b50a069a")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "a9ea7dbbc8e5afd08e00e223a831b578")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "3b90f67f4b429e77d3da36698cef700c")
|
||||
# Binaries branch name: ffmpeg/master_20190616
|
||||
# Binaries were created for OpenCV: 7b099e0fe2d929e55d6705b6ad510c2c9081606b
|
||||
ocv_update(FFMPEG_BINARIES_COMMIT "998718df34e35ea0fa429724875fc3900faa266f")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN32 "f03b47fb809edd2e06b6db135cbd3e49")
|
||||
ocv_update(FFMPEG_FILE_HASH_BIN64 "5c4571459570c288d874704244c428b5")
|
||||
ocv_update(FFMPEG_FILE_HASH_CMAKE "f710891525a04586d565d0e700e62a9c")
|
||||
|
||||
function(download_win_ffmpeg script_var)
|
||||
set(${script_var} "" PARENT_SCOPE)
|
||||
|
||||
set(ids BIN32 BIN64 CMAKE)
|
||||
set(name_BIN32 "opencv_ffmpeg.dll")
|
||||
set(name_BIN64 "opencv_ffmpeg_64.dll")
|
||||
set(name_BIN32 "opencv_videoio_ffmpeg.dll")
|
||||
set(name_BIN64 "opencv_videoio_ffmpeg_64.dll")
|
||||
set(name_CMAKE "ffmpeg_version.cmake")
|
||||
|
||||
set(FFMPEG_DOWNLOAD_DIR "${OpenCV_BINARY_DIR}/3rdparty/ffmpeg")
|
||||
|
||||
Vendored
+4
-4
@@ -13,10 +13,10 @@
|
||||
|
||||
* On Windows OpenCV uses pre-built ffmpeg binaries, built with proper flags (without GPL components) and
|
||||
wrapped with simple, stable OpenCV-compatible API.
|
||||
The binaries are opencv_ffmpeg.dll (version for 32-bit Windows) and
|
||||
opencv_ffmpeg_64.dll (version for 64-bit Windows).
|
||||
The binaries are opencv_videoio_ffmpeg.dll (version for 32-bit Windows) and
|
||||
opencv_videoio_ffmpeg_64.dll (version for 64-bit Windows).
|
||||
|
||||
The pre-built opencv_ffmpeg*.dll is:
|
||||
The pre-built opencv_videoio_ffmpeg*.dll is:
|
||||
* LGPL library, not BSD libraries.
|
||||
* Loaded at runtime by opencv_videoio module.
|
||||
If it succeeds, ffmpeg can be used to decode/encode videos;
|
||||
@@ -30,7 +30,7 @@
|
||||
Or you can specify location of binary file via OPENH264_LIBRARY environment variable.
|
||||
|
||||
If LGPL/GPL software can not be supplied with your OpenCV-based product, simply exclude
|
||||
opencv_ffmpeg*.dll from your distribution; OpenCV will stay fully functional except for the ability to
|
||||
opencv_videoio_ffmpeg*.dll from your distribution; OpenCV will stay fully functional except for the ability to
|
||||
decode/encode videos using FFMPEG (though, it may still be able to do that using other API,
|
||||
such as Video for Windows, Windows Media Foundation or our self-contained motion jpeg codec).
|
||||
|
||||
|
||||
+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
|
||||
+7
-1
@@ -196,6 +196,10 @@
|
||||
# define ITT_ARCH_PPC64 5
|
||||
#endif /* ITT_ARCH_PPC64 */
|
||||
|
||||
#ifndef ITT_ARCH_AARCH64 /* 64-bit ARM */
|
||||
# define ITT_ARCH_AARCH64 6
|
||||
#endif /* ITT_ARCH_AARCH64 */
|
||||
|
||||
#ifndef ITT_ARCH
|
||||
# if defined _M_IX86 || defined __i386__
|
||||
# define ITT_ARCH ITT_ARCH_IA32
|
||||
@@ -205,6 +209,8 @@
|
||||
# define ITT_ARCH ITT_ARCH_IA64
|
||||
# elif defined _M_ARM || defined __arm__
|
||||
# define ITT_ARCH ITT_ARCH_ARM
|
||||
# elif defined __aarch64__
|
||||
# define ITT_ARCH ITT_ARCH_AARCH64
|
||||
# elif defined __powerpc64__
|
||||
# define ITT_ARCH ITT_ARCH_PPC64
|
||||
# endif
|
||||
@@ -359,7 +365,7 @@ ITT_INLINE long __TBB_machine_fetchadd4(volatile void* ptr, long addend)
|
||||
: "memory");
|
||||
return result;
|
||||
}
|
||||
#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_PPC64
|
||||
#elif ITT_ARCH==ITT_ARCH_ARM || ITT_ARCH==ITT_ARCH_AARCH64 || ITT_ARCH==ITT_ARCH_PPC64
|
||||
#define __TBB_machine_fetchadd4(addr, val) __sync_fetch_and_add(addr, val)
|
||||
#endif /* ITT_ARCH==ITT_ARCH_IA64 */
|
||||
#ifndef ITT_SIMPLE_INIT
|
||||
|
||||
+3
-2
@@ -78,10 +78,11 @@ configure_file(jconfigint.h.in jconfigint.h)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
set(JPEG_SOURCES jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c
|
||||
set(JPEG_SOURCES
|
||||
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
|
||||
jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c jdatasrc.c
|
||||
jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c jdmarker.c
|
||||
jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdicc.c jdinput.c jdmainct.c jdmarker.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
|
||||
jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c)
|
||||
|
||||
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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++;
|
||||
}
|
||||
}
|
||||
Vendored
+171
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* 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
+9
-6
@@ -1,7 +1,7 @@
|
||||
The Independent JPEG Group's JPEG software
|
||||
==========================================
|
||||
|
||||
README for release 9b of 17-Jan-2016
|
||||
README for release 9c of 14-Jan-2018
|
||||
====================================
|
||||
|
||||
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,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
||||
This software is copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
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 most recent released version can always be found there in
|
||||
directory "files". This particular version will be archived as
|
||||
http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible
|
||||
"zip" archive format as http://www.ijg.org/files/jpegsr9b.zip.
|
||||
http://www.ijg.org/files/jpegsrc.v9c.tar.gz, and in Windows-compatible
|
||||
"zip" archive format as http://www.ijg.org/files/jpegsr9c.zip.
|
||||
|
||||
The JPEG FAQ (Frequently Asked Questions) article is a source of some
|
||||
general information about JPEG.
|
||||
@@ -293,8 +293,11 @@ communication about JPEG configuration in Sigma Photo Pro software.
|
||||
|
||||
Thank to Andrew Finkenstadt for hosting the ijg.org site.
|
||||
|
||||
Last but not least special thank to Thomas G. Lane for the original
|
||||
design and development of this singular software package.
|
||||
Thank to Thomas G. Lane for the original 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
|
||||
|
||||
Vendored
+21
@@ -1,6 +1,27 @@
|
||||
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
|
||||
-----------------------
|
||||
|
||||
|
||||
Vendored
+167
-2
@@ -2,7 +2,7 @@
|
||||
* jcinit.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* Modified 2003-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -21,6 +21,168 @@
|
||||
#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.
|
||||
* This is done once at the start of processing an image. We determine
|
||||
@@ -37,7 +199,7 @@ jinit_compress_master (j_compress_ptr cinfo)
|
||||
if (cinfo->data_precision != BITS_IN_JSAMPLE)
|
||||
ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
|
||||
|
||||
/* Sanity check on image dimensions */
|
||||
/* Sanity check on input image dimensions */
|
||||
if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
|
||||
cinfo->input_components <= 0)
|
||||
ERREXIT(cinfo, JERR_EMPTY_IMAGE);
|
||||
@@ -48,6 +210,9 @@ jinit_compress_master (j_compress_ptr cinfo)
|
||||
if ((long) jd_samplesperrow != samplesperrow)
|
||||
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
|
||||
|
||||
/* Compute JPEG image dimensions and related values. */
|
||||
jpeg_calc_jpeg_dimensions(cinfo);
|
||||
|
||||
/* Initialize master control (includes parameter checking/processing) */
|
||||
jinit_c_master_control(cinfo, FALSE /* full compression */);
|
||||
|
||||
|
||||
Vendored
+5
-187
@@ -2,7 +2,7 @@
|
||||
* jcmaster.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2003-2013 by Guido Vollbeding.
|
||||
* Modified 2003-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -43,191 +43,13 @@ typedef my_comp_master * my_master_ptr;
|
||||
* 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)
|
||||
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)
|
||||
initial_setup (j_compress_ptr cinfo)
|
||||
/* Do computations that are needed before master selection phase */
|
||||
{
|
||||
int ci, ssize;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
if (transcode_only)
|
||||
jpeg_calc_trans_dimensions(cinfo);
|
||||
else
|
||||
jpeg_calc_jpeg_dimensions(cinfo);
|
||||
|
||||
/* Sanity check on block_size */
|
||||
if (cinfo->block_size < 1 || cinfo->block_size > 16)
|
||||
ERREXIT2(cinfo, JERR_BAD_DCTSIZE, cinfo->block_size, cinfo->block_size);
|
||||
@@ -414,13 +236,9 @@ validate_script (j_compress_ptr cinfo)
|
||||
* out-of-range reconstructed DC values during the first DC scan,
|
||||
* 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 ||
|
||||
Ah < 0 || Ah > MAX_AH_AL || Al < 0 || Al > MAX_AH_AL)
|
||||
Ah < 0 || Ah > (cinfo->data_precision > 8 ? 13 : 10) ||
|
||||
Al < 0 || Al > (cinfo->data_precision > 8 ? 13 : 10))
|
||||
ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
|
||||
if (Ss == 0) {
|
||||
if (Se != 0) /* DC and AC together not OK */
|
||||
@@ -812,7 +630,7 @@ jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
|
||||
master->pub.is_last_pass = FALSE;
|
||||
|
||||
/* Validate parameters, determine derived values */
|
||||
initial_setup(cinfo, transcode_only);
|
||||
initial_setup(cinfo);
|
||||
|
||||
if (cinfo->scan_info != NULL) {
|
||||
#ifdef C_MULTISCAN_FILES_SUPPORTED
|
||||
|
||||
Vendored
+21
-3
@@ -2,7 +2,7 @@
|
||||
* jctrans.c
|
||||
*
|
||||
* Copyright (C) 1995-1998, Thomas G. Lane.
|
||||
* Modified 2000-2013 by Guido Vollbeding.
|
||||
* Modified 2000-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -85,12 +85,15 @@ jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
|
||||
jpeg_set_defaults(dstinfo);
|
||||
/* 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.
|
||||
* Note: Entropy table assignment in jpeg_set_colorspace depends
|
||||
* on color_transform.
|
||||
* Note: Entropy table assignment in jpeg_set_colorspace
|
||||
* depends 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;
|
||||
jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
|
||||
dstinfo->data_precision = srcinfo->data_precision;
|
||||
dstinfo->arith_code = srcinfo->data_precision > 8 ? TRUE : FALSE;
|
||||
dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
|
||||
/* Copy the source's quantization tables. */
|
||||
for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
|
||||
@@ -157,6 +160,18 @@ 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.
|
||||
* This substitutes for jcinit.c's initialization of the full compressor.
|
||||
@@ -166,6 +181,9 @@ LOCAL(void)
|
||||
transencode_master_selection (j_compress_ptr cinfo,
|
||||
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) */
|
||||
jinit_c_master_control(cinfo, TRUE /* transcode only */);
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -2,7 +2,7 @@
|
||||
* jdatadst.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2012 by Guido Vollbeding.
|
||||
* Modified 2009-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -170,9 +170,9 @@ term_destination (j_compress_ptr cinfo)
|
||||
if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
|
||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||
}
|
||||
fflush(dest->outfile);
|
||||
JFFLUSH(dest->outfile);
|
||||
/* Make sure we wrote the output file OK */
|
||||
if (ferror(dest->outfile))
|
||||
if (JFERROR(dest->outfile))
|
||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+7
-1
@@ -2,7 +2,7 @@
|
||||
* jdcolor.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2011-2015 by Guido Vollbeding.
|
||||
* Modified 2011-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -14,6 +14,12 @@
|
||||
#include "jpeglib.h"
|
||||
|
||||
|
||||
#if RANGE_BITS < 2
|
||||
/* Deliberate syntax err */
|
||||
Sorry, this code requires 2 or more range extension bits.
|
||||
#endif
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
|
||||
typedef struct {
|
||||
|
||||
Vendored
+5
-6
@@ -2,7 +2,7 @@
|
||||
* jdct.h
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2015 by Guido Vollbeding.
|
||||
* Modified 2002-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -79,13 +79,12 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
|
||||
* 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
|
||||
* range-limiting step is required. We use a mask-and-table-lookup method
|
||||
* to do the combined operations quickly, assuming that MAXJSAMPLE+1
|
||||
* is a power of 2. See the comments with prepare_range_limit_table
|
||||
* (in jdmaster.c) for more info.
|
||||
* to do the combined operations quickly, assuming that RANGE_CENTER
|
||||
* (defined in jpegint.h) is a power of 2. See the comments with
|
||||
* prepare_range_limit_table (in jdmaster.c) for more info.
|
||||
*/
|
||||
|
||||
#define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
|
||||
#define RANGE_CENTER (MAXJSAMPLE * 2 + 2)
|
||||
#define RANGE_MASK (RANGE_CENTER * 2 - 1)
|
||||
#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE)
|
||||
|
||||
#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET)
|
||||
|
||||
Vendored
+4
-5
@@ -2,7 +2,7 @@
|
||||
* jdhuff.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2006-2013 by Guido Vollbeding.
|
||||
* Modified 2006-2016 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -799,10 +799,6 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
*/
|
||||
if (! entropy->insufficient_data) {
|
||||
|
||||
Se = cinfo->Se;
|
||||
Al = cinfo->Al;
|
||||
natural_order = cinfo->natural_order;
|
||||
|
||||
/* Load up working state.
|
||||
* We can avoid loading/saving bitread state if in an EOB run.
|
||||
*/
|
||||
@@ -814,6 +810,9 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
|
||||
EOBRUN--; /* ...process it now (we do nothing) */
|
||||
else {
|
||||
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
|
||||
Se = cinfo->Se;
|
||||
Al = cinfo->Al;
|
||||
natural_order = cinfo->natural_order;
|
||||
block = MCU_data[0];
|
||||
tbl = entropy->ac_derived_tbl;
|
||||
|
||||
|
||||
Vendored
+20
-26
@@ -2,7 +2,7 @@
|
||||
* jdmainct.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2012 by Guido Vollbeding.
|
||||
* Modified 2002-2016 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -26,8 +26,8 @@
|
||||
* trivial. Its responsibility is to provide context rows for upsampling/
|
||||
* rescaling, and doing this in an efficient fashion is a bit tricky.
|
||||
*
|
||||
* Postprocessor input data is counted in "row groups". A row group
|
||||
* is defined to be (v_samp_factor * DCT_scaled_size / min_DCT_scaled_size)
|
||||
* Postprocessor input data is counted in "row groups". A row group is
|
||||
* defined to be (v_samp_factor * DCT_v_scaled_size / min_DCT_v_scaled_size)
|
||||
* 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
|
||||
* values will likely be powers of two, so we actually have the stronger
|
||||
@@ -37,8 +37,8 @@
|
||||
* applying).
|
||||
*
|
||||
* The coefficient controller will deliver data to us one iMCU row at a time;
|
||||
* each iMCU row contains v_samp_factor * DCT_scaled_size sample rows, or
|
||||
* exactly min_DCT_scaled_size row groups. (This amount of data corresponds
|
||||
* each iMCU row contains v_samp_factor * DCT_v_scaled_size sample rows, or
|
||||
* exactly min_DCT_v_scaled_size row groups. (This amount of data corresponds
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* consisting of M+2 row groups (where M = min_DCT_scaled_size is the number
|
||||
* consisting of M+2 row groups (where M = min_DCT_v_scaled_size is the number
|
||||
* 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
|
||||
* pointer lists look like this:
|
||||
@@ -100,11 +100,11 @@
|
||||
* the first or last sample row as necessary (this is cheaper than copying
|
||||
* sample rows around).
|
||||
*
|
||||
* This scheme breaks down if M < 2, ie, min_DCT_scaled_size is 1. In that
|
||||
* This scheme breaks down if M < 2, ie, min_DCT_v_scaled_size is 1. In that
|
||||
* 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
|
||||
* first row group). For now, we simply do not support providing context
|
||||
* rows when min_DCT_scaled_size is 1. That combination seems unlikely to
|
||||
* rows when min_DCT_v_scaled_size is 1. That combination seems unlikely to
|
||||
* 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.
|
||||
*/
|
||||
@@ -118,17 +118,18 @@ typedef struct {
|
||||
/* Pointer to allocated workspace (M or M+2 row groups). */
|
||||
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 rowgroups_avail; /* row groups available to postprocessor */
|
||||
|
||||
/* 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. */
|
||||
JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */
|
||||
|
||||
int whichptr; /* indicates which pointer set is now in use */
|
||||
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 */
|
||||
} my_main_controller;
|
||||
|
||||
@@ -195,7 +196,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo)
|
||||
LOCAL(void)
|
||||
make_funny_pointers (j_decompress_ptr cinfo)
|
||||
/* Create the funny pointer lists discussed in the comments above.
|
||||
* The actual workspace is already allocated (in main->buffer),
|
||||
* The actual workspace is already allocated (in mainp->buffer),
|
||||
* and the space for the pointer lists is allocated too.
|
||||
* This routine just fills in the curiously ordered lists.
|
||||
* This will be repeated at the beginning of each pass.
|
||||
@@ -317,12 +318,12 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
|
||||
mainp->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
|
||||
mainp->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
mainp->iMCU_row_ctr = 0;
|
||||
mainp->buffer_full = FALSE; /* Mark buffer empty */
|
||||
} else {
|
||||
/* Simple case with no context needed */
|
||||
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;
|
||||
#ifdef QUANT_2PASS_SUPPORTED
|
||||
case JBUF_CRANK_DEST:
|
||||
@@ -348,17 +349,14 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||
JDIMENSION out_rows_avail)
|
||||
{
|
||||
my_main_ptr mainp = (my_main_ptr) cinfo->main;
|
||||
JDIMENSION rowgroups_avail;
|
||||
|
||||
/* Read input data if we haven't filled the main buffer yet */
|
||||
if (! mainp->buffer_full) {
|
||||
if (mainp->rowgroup_ctr >= mainp->rowgroups_avail) {
|
||||
if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer))
|
||||
return; /* suspension forced, can do nothing more */
|
||||
mainp->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
|
||||
mainp->rowgroup_ctr = 0; /* 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
|
||||
* to the postprocessor. The postprocessor has to check for bottom
|
||||
* of image anyway (at row resolution), so no point in us doing it too.
|
||||
@@ -366,14 +364,8 @@ process_data_simple_main (j_decompress_ptr cinfo,
|
||||
|
||||
/* Feed the postprocessor */
|
||||
(*cinfo->post->post_process_data) (cinfo, mainp->buffer,
|
||||
&mainp->rowgroup_ctr, rowgroups_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;
|
||||
}
|
||||
&mainp->rowgroup_ctr, mainp->rowgroups_avail,
|
||||
output_buf, out_row_ctr, out_rows_avail);
|
||||
}
|
||||
|
||||
|
||||
@@ -498,7 +490,9 @@ jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
|
||||
alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
|
||||
ngroups = cinfo->min_DCT_v_scaled_size + 2;
|
||||
} else {
|
||||
/* There are always min_DCT_v_scaled_size row groups in an iMCU row. */
|
||||
ngroups = cinfo->min_DCT_v_scaled_size;
|
||||
mainp->rowgroups_avail = (JDIMENSION) ngroups;
|
||||
}
|
||||
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
|
||||
Vendored
+6
-7
@@ -2,7 +2,7 @@
|
||||
* jdmaster.c
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2002-2015 by Guido Vollbeding.
|
||||
* Modified 2002-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -237,18 +237,17 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
|
||||
JSAMPLE * table;
|
||||
int i;
|
||||
|
||||
table = (JSAMPLE *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||
table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
|
||||
JPOOL_IMAGE, (RANGE_CENTER * 2 + MAXJSAMPLE + 1) * SIZEOF(JSAMPLE));
|
||||
/* First segment of range limit table: limit[x] = 0 for x < 0 */
|
||||
MEMZERO(table, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||
table += 2 * (MAXJSAMPLE+1); /* allow negative subscripts of table */
|
||||
MEMZERO(table, RANGE_CENTER * SIZEOF(JSAMPLE));
|
||||
table += RANGE_CENTER; /* allow negative subscripts of table */
|
||||
cinfo->sample_range_limit = table;
|
||||
/* Main part of range limit table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||
table[i] = (JSAMPLE) i;
|
||||
/* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */
|
||||
for (; i < 3 * (MAXJSAMPLE+1); i++)
|
||||
for (; i <= MAXJSAMPLE + RANGE_CENTER; i++)
|
||||
table[i] = MAXJSAMPLE;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+7
-1
@@ -2,7 +2,7 @@
|
||||
* jdmerge.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2013-2015 by Guido Vollbeding.
|
||||
* Modified 2013-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -40,6 +40,12 @@
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
|
||||
|
||||
#if RANGE_BITS < 2
|
||||
/* Deliberate syntax err */
|
||||
Sorry, this code requires 2 or more range extension bits.
|
||||
#endif
|
||||
|
||||
|
||||
/* Private subobject */
|
||||
|
||||
typedef struct {
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
* jfdctflt.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2003-2015 by Guido Vollbeding.
|
||||
* Modified 2003-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -48,7 +48,7 @@
|
||||
*/
|
||||
|
||||
#if DCTSIZE != 8
|
||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
* jfdctfst.c
|
||||
*
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2003-2015 by Guido Vollbeding.
|
||||
* Modified 2003-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -44,7 +44,7 @@
|
||||
*/
|
||||
|
||||
#if DCTSIZE != 8
|
||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
* jidctflt.c
|
||||
*
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2010-2015 by Guido Vollbeding.
|
||||
* Modified 2010-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#if DCTSIZE != 8
|
||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
* jidctfst.c
|
||||
*
|
||||
* Copyright (C) 1994-1998, Thomas G. Lane.
|
||||
* Modified 2015 by Guido Vollbeding.
|
||||
* Modified 2015-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#if DCTSIZE != 8
|
||||
Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
|
||||
Sorry, this code only copes with 8x8 DCT blocks. /* deliberate syntax err */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Vendored
+18
-17
@@ -2,7 +2,7 @@
|
||||
* jidctint.c
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modification developed 2002-2015 by Guido Vollbeding.
|
||||
* Modification developed 2002-2016 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -166,6 +166,7 @@
|
||||
/*
|
||||
* 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).
|
||||
*/
|
||||
|
||||
@@ -428,7 +429,7 @@ jpeg_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
|
||||
/*
|
||||
* Perform dequantization and inverse DCT on one block of coefficients,
|
||||
* producing a 7x7 output block.
|
||||
* producing a reduced-size 7x7 output block.
|
||||
*
|
||||
* Optimized algorithm with 12 multiplications in the 1-D kernel.
|
||||
* cK represents sqrt(2) * cos(K*pi/14).
|
||||
@@ -2623,7 +2624,7 @@ jpeg_idct_16x16 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
|
||||
tmp0 <<= CONST_BITS;
|
||||
/* Add fudge factor here for final descale. */
|
||||
tmp0 += 1 << (CONST_BITS-PASS1_BITS-1);
|
||||
tmp0 += ONE << (CONST_BITS-PASS1_BITS-1);
|
||||
|
||||
z1 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */
|
||||
@@ -2920,13 +2921,6 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
* 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]);
|
||||
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||
z2 <<= CONST_BITS;
|
||||
@@ -2937,6 +2931,13 @@ jpeg_idct_16x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
tmp0 = 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;
|
||||
tmp13 = tmp0 - tmp2;
|
||||
tmp11 = tmp1 + tmp3;
|
||||
@@ -4883,13 +4884,6 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
* 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]);
|
||||
z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
|
||||
z2 <<= CONST_BITS;
|
||||
@@ -4900,6 +4894,13 @@ jpeg_idct_4x8 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
tmp0 = 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;
|
||||
tmp13 = tmp0 - tmp2;
|
||||
tmp11 = tmp1 + tmp3;
|
||||
|
||||
Vendored
+6
@@ -2,6 +2,7 @@
|
||||
* jinclude.h
|
||||
*
|
||||
* Copyright (C) 1991-1994, Thomas G. Lane.
|
||||
* Modified 2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -83,9 +84,14 @@
|
||||
* The modules that use fread() and fwrite() always invoke them through
|
||||
* these macros. On some systems you may need to twiddle the argument casts.
|
||||
* 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) \
|
||||
((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||
#define JFWRITE(file,buf,sizeofbuf) \
|
||||
((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
|
||||
#define JFFLUSH(file) fflush(file)
|
||||
#define JFERROR(file) ferror(file)
|
||||
|
||||
Vendored
+14
-1
@@ -2,7 +2,7 @@
|
||||
* jpegint.h
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 1997-2013 by Guido Vollbeding.
|
||||
* Modified 1997-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -260,6 +260,19 @@ 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 */
|
||||
|
||||
#undef MAX
|
||||
|
||||
Vendored
+14
-14
@@ -2,7 +2,7 @@
|
||||
* jpeglib.h
|
||||
*
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2015 by Guido Vollbeding.
|
||||
* Modified 2002-2017 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
|
||||
#define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */
|
||||
#define JPEG_LIB_VERSION_MAJOR 9
|
||||
#define JPEG_LIB_VERSION_MINOR 2
|
||||
#define JPEG_LIB_VERSION_MINOR 3
|
||||
|
||||
|
||||
/* Various constants determining the sizes of things.
|
||||
@@ -137,9 +137,9 @@ typedef struct {
|
||||
/* The decompressor output side may not use these variables. */
|
||||
int dc_tbl_no; /* DC entropy table selector (0..3) */
|
||||
int ac_tbl_no; /* AC entropy table selector (0..3) */
|
||||
|
||||
|
||||
/* Remaining fields should be treated as private by applications. */
|
||||
|
||||
|
||||
/* These values are computed during compression or decompression startup: */
|
||||
/* Component's size in DCT blocks.
|
||||
* 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 */
|
||||
/* The coefficient controller receives data in units of MCU rows as defined
|
||||
* for fully interleaved scans (whether the JPEG file is interleaved or not).
|
||||
* There are v_samp_factor * DCTSIZE sample rows of each component in an
|
||||
* "iMCU" (interleaved MCU) row.
|
||||
* There are v_samp_factor * DCT_v_scaled_size sample rows of each component
|
||||
* in an "iMCU" (interleaved MCU) row.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* These fields are valid during any one 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 */
|
||||
jpeg_component_info * cur_comp_info[MAX_COMPS_IN_SCAN];
|
||||
/* *cur_comp_info[i] describes component that appears i'th in SOS */
|
||||
|
||||
|
||||
JDIMENSION MCUs_per_row; /* # of MCUs across the image */
|
||||
JDIMENSION MCU_rows_in_scan; /* # of MCU rows in the image */
|
||||
|
||||
|
||||
int blocks_in_MCU; /* # of DCT blocks per MCU */
|
||||
int MCU_membership[C_MAX_BLOCKS_IN_MCU];
|
||||
/* 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
|
||||
* interleaved or not. We define an iMCU row as v_samp_factor DCT block
|
||||
* 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 */
|
||||
@@ -711,7 +711,7 @@ struct jpeg_error_mgr {
|
||||
#define JMSG_LENGTH_MAX 200 /* recommended size of format_message buffer */
|
||||
/* Reset error state variables at start of a new image */
|
||||
JMETHOD(void, reset_error_mgr, (j_common_ptr cinfo));
|
||||
|
||||
|
||||
/* The message ID code and any parameters are saved here.
|
||||
* A message can have one string parameter or up to 8 int parameters.
|
||||
*/
|
||||
@@ -721,11 +721,11 @@ struct jpeg_error_mgr {
|
||||
int i[8];
|
||||
char s[JMSG_STR_PARM_MAX];
|
||||
} msg_parm;
|
||||
|
||||
|
||||
/* Standard state variables for error facility */
|
||||
|
||||
|
||||
int trace_level; /* max msg_level that will be displayed */
|
||||
|
||||
|
||||
/* For recoverable corrupt-data errors, we emit a warning message,
|
||||
* but keep going unless emit_message chooses to abort. emit_message
|
||||
* should count warnings in num_warnings. The surrounding application
|
||||
|
||||
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jversion.h
|
||||
*
|
||||
* Copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
|
||||
* Copyright (C) 1991-2018, Thomas G. Lane, Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
@@ -9,6 +9,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#define JVERSION "9b 17-Jan-2016"
|
||||
#define JVERSION "9c 14-Jan-2018"
|
||||
|
||||
#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding"
|
||||
#define JCOPYRIGHT "Copyright (C) 2018, Thomas G. Lane, Guido Vollbeding"
|
||||
|
||||
Vendored
+26
-13
@@ -6066,31 +6066,44 @@ Version 1.6.35 [July 15, 2018]
|
||||
Version 1.6.36 [December 1, 2018]
|
||||
Optimized png_do_expand_palette for ARM processors.
|
||||
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.
|
||||
(Contributed by Vicki Pfau)
|
||||
(Contributed by Vicki Pfau)
|
||||
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.
|
||||
(Contributed by Zhijie Liang)
|
||||
(Contributed by Zhijie Liang)
|
||||
Fixed detection of libm in CMakeLists.
|
||||
(Contributed by Cameron Cawley)
|
||||
(Contributed by Cameron Cawley)
|
||||
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 a build warning on OpenBSD.
|
||||
(Contributed by Theo Buehler)
|
||||
(Contributed by Theo Buehler)
|
||||
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.
|
||||
Removed yet more of the vestigial support for pre-ANSI C compilers.
|
||||
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
|
||||
information.
|
||||
information.
|
||||
Applied various code style and documentation fixes.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
Version 1.6.37 [April 14, 2019]
|
||||
Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
|
||||
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
|
||||
to subscribe).
|
||||
to subscribe.
|
||||
|
||||
Vendored
+4
-4
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
|
||||
PNG Reference Library License version 2
|
||||
---------------------------------------
|
||||
|
||||
* Copyright (c) 1995-2018 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018 Cosmin Truta.
|
||||
* Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
||||
* Copyright (c) 2018-2019 Cosmin Truta.
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* 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,
|
||||
express or implied, including, without limitation, the warranties
|
||||
of merchantability, fitness for a particular purpose, title, and
|
||||
non-infringement. In no even shall the Copyright owners, or
|
||||
non-infringement. In no event shall the Copyright owners, or
|
||||
anyone distributing the software, be liable for any damages or
|
||||
other liability, whether in contract, tort or otherwise, arising
|
||||
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)
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
README for libpng version 1.6.36 - December 1, 2018
|
||||
===================================================
|
||||
README for libpng version 1.6.37 - April 14, 2019
|
||||
=================================================
|
||||
|
||||
See the note about version numbers near the top of png.h.
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
||||
+16
-16
@@ -1,7 +1,7 @@
|
||||
|
||||
/* palette_neon_intrinsics.c - NEON optimised palette expansion functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 2017-2018 Arm Holdings. All rights reserved.
|
||||
* Written by Richard Townsend <Richard.Townsend@arm.com>, February 2017.
|
||||
*
|
||||
@@ -20,9 +20,9 @@
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
/* Build an RGBA palette from the RGB and separate alpha palettes. */
|
||||
/* Build an RGBA8 palette from the separate RGB and alpha palettes. */
|
||||
void
|
||||
png_riffle_palette_rgba(png_structrp png_ptr, png_row_infop row_info)
|
||||
png_riffle_palette_neon(png_structrp png_ptr)
|
||||
{
|
||||
png_const_colorp palette = png_ptr->palette;
|
||||
png_bytep riffled_palette = png_ptr->riffled_palette;
|
||||
@@ -30,6 +30,8 @@ png_riffle_palette_rgba(png_structrp png_ptr, png_row_infop row_info)
|
||||
int num_trans = png_ptr->num_trans;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_riffle_palette_neon");
|
||||
|
||||
/* Initially black, opaque. */
|
||||
uint8x16x4_t w = {{
|
||||
vdupq_n_u8(0x00),
|
||||
@@ -38,16 +40,10 @@ png_riffle_palette_rgba(png_structrp png_ptr, png_row_infop row_info)
|
||||
vdupq_n_u8(0xff),
|
||||
}};
|
||||
|
||||
if (row_info->bit_depth != 8)
|
||||
{
|
||||
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.
|
||||
/* First, riffle the RGB colours into an RGBA8 palette.
|
||||
* The alpha component is set to opaque for now.
|
||||
*/
|
||||
for (i = 0; i < (1 << row_info->bit_depth); i += 16)
|
||||
for (i = 0; i < 256; i += 16)
|
||||
{
|
||||
uint8x16x3_t v = vld3q_u8((png_const_bytep)(palette + i));
|
||||
w.val[0] = v.val[0];
|
||||
@@ -61,9 +57,9 @@ png_riffle_palette_rgba(png_structrp png_ptr, png_row_infop row_info)
|
||||
riffled_palette[(i << 2) + 3] = trans_alpha[i];
|
||||
}
|
||||
|
||||
/* Expands a palettized row into RGBA. */
|
||||
/* Expands a palettized row into RGBA8. */
|
||||
int
|
||||
png_do_expand_palette_neon_rgba(png_structrp png_ptr, png_row_infop row_info,
|
||||
png_do_expand_palette_rgba8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
@@ -72,6 +68,8 @@ png_do_expand_palette_neon_rgba(png_structrp png_ptr, png_row_infop row_info,
|
||||
const png_int_32 pixels_per_chunk = 4;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_do_expand_palette_rgba8_neon");
|
||||
|
||||
if (row_width < pixels_per_chunk)
|
||||
return 0;
|
||||
|
||||
@@ -103,9 +101,9 @@ png_do_expand_palette_neon_rgba(png_structrp png_ptr, png_row_infop row_info,
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Expands a palettized row into RGB format. */
|
||||
/* Expands a palettized row into RGB8. */
|
||||
int
|
||||
png_do_expand_palette_neon_rgb(png_structrp png_ptr, png_row_infop row_info,
|
||||
png_do_expand_palette_rgb8_neon(png_structrp png_ptr, png_row_infop row_info,
|
||||
png_const_bytep row, png_bytepp ssp, png_bytepp ddp)
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
@@ -113,6 +111,8 @@ png_do_expand_palette_neon_rgb(png_structrp png_ptr, png_row_infop row_info,
|
||||
const png_uint_32 pixels_per_chunk = 8;
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_do_expand_palette_rgb8_neon");
|
||||
|
||||
if (row_width <= pixels_per_chunk)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
Vendored
+5
-6
@@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_36 Your_png_h_is_not_version_1_6_36;
|
||||
typedef png_libpng_version_1_6_37 Your_png_h_is_not_version_1_6_37;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* 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
|
||||
#else
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.36" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 2018 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.37" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 2018-2019 Cosmin Truta" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
@@ -4588,8 +4588,7 @@ png_image_free(png_imagep image)
|
||||
if (image != NULL && image->opaque != NULL &&
|
||||
image->opaque->error_buf == NULL)
|
||||
{
|
||||
/* Ignore errors here: */
|
||||
(void)png_safe_execute(image, png_image_free_function, image);
|
||||
png_image_free_function(image);
|
||||
image->opaque = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+17
-17
@@ -1,9 +1,9 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.36 - December 1, 2018
|
||||
* libpng version 1.6.37 - April 14, 2019
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -14,8 +14,9 @@
|
||||
* 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.97, January 1998, through 1.6.35, July 2018:
|
||||
* Glenn Randers-Pehrson.
|
||||
* libpng version 1.6.36, December 1, 2018: Cosmin Truta
|
||||
* Glenn Randers-Pehrson
|
||||
* libpng versions 1.6.36, December 2018, through 1.6.37, April 2019:
|
||||
* Cosmin Truta
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
|
||||
@@ -26,8 +27,8 @@
|
||||
* PNG Reference Library License version 2
|
||||
* ---------------------------------------
|
||||
*
|
||||
* * Copyright (c) 1995-2018 The PNG Reference Library Authors.
|
||||
* * Copyright (c) 2018 Cosmin Truta.
|
||||
* * Copyright (c) 1995-2019 The PNG Reference Library Authors.
|
||||
* * Copyright (c) 2018-2019 Cosmin Truta.
|
||||
* * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
|
||||
* * Copyright (c) 1996-1997 Andreas Dilger.
|
||||
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -35,7 +36,7 @@
|
||||
* The software is supplied "as is", without warranty of any kind,
|
||||
* express or implied, including, without limitation, the warranties
|
||||
* of merchantability, fitness for a particular purpose, title, and
|
||||
* non-infringement. In no even shall the Copyright owners, or
|
||||
* non-infringement. In no event shall the Copyright owners, or
|
||||
* anyone distributing the software, be liable for any damages or
|
||||
* other liability, whether in contract, tort or otherwise, arising
|
||||
* from, out of, or in connection with the software, or the use or
|
||||
@@ -61,7 +62,7 @@
|
||||
* 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
|
||||
* 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
|
||||
@@ -238,7 +239,7 @@
|
||||
* ...
|
||||
* 1.5.30 15 10530 15.so.15.30[.0]
|
||||
* ...
|
||||
* 1.6.36 16 10636 16.so.16.36[.0]
|
||||
* 1.6.37 16 10637 16.so.16.37[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major and
|
||||
* minor numbers; the shared-library major version number will be used for
|
||||
@@ -277,8 +278,8 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.36"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.36 - December 1, 2018\n"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.37"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.37 - April 14, 2019\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@@ -286,12 +287,11 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 36
|
||||
#define PNG_LIBPNG_VER_RELEASE 37
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
/* This should be zero for a public release, or non-zero for a
|
||||
* development version. [Deprecated]
|
||||
*/
|
||||
|
||||
#define PNG_LIBPNG_VER_BUILD 0
|
||||
|
||||
/* Release Status */
|
||||
@@ -318,7 +318,7 @@
|
||||
* From version 1.0.1 it is:
|
||||
* XXYYZZ, where XX=major, YY=minor, ZZ=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10636 /* 1.6.36 */
|
||||
#define PNG_LIBPNG_VER 10637 /* 1.6.37 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* 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
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_36;
|
||||
typedef char* png_libpng_version_1_6_37;
|
||||
|
||||
/* 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.36
|
||||
* libpng version 1.6.37
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* libpng version 1.6.36 */
|
||||
/* libpng version 1.6.37 */
|
||||
|
||||
/* Copyright (c) 2018 Cosmin Truta */
|
||||
/* Copyright (c) 2018-2019 Cosmin Truta */
|
||||
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
|
||||
|
||||
/* This code is released under the libpng license. */
|
||||
|
||||
Vendored
+5
-5
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* 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
|
||||
PNG_INTERNAL_FUNCTION(void,
|
||||
png_riffle_palette_rgba,
|
||||
(png_structrp, png_row_infop),
|
||||
png_riffle_palette_neon,
|
||||
(png_structrp),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(int,
|
||||
png_do_expand_palette_neon_rgba,
|
||||
png_do_expand_palette_rgba8_neon,
|
||||
(png_structrp,
|
||||
png_row_infop,
|
||||
png_const_bytep,
|
||||
@@ -2131,7 +2131,7 @@ PNG_INTERNAL_FUNCTION(int,
|
||||
const png_bytepp),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(int,
|
||||
png_do_expand_palette_neon_rgb,
|
||||
png_do_expand_palette_rgb8_neon,
|
||||
(png_structrp,
|
||||
png_row_infop,
|
||||
png_const_bytep,
|
||||
|
||||
Vendored
+7
-1
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -994,6 +994,12 @@ png_read_destroy(png_structrp png_ptr)
|
||||
png_ptr->chunk_list = NULL;
|
||||
#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
|
||||
* callbacks are still set at this point. They are required to complete the
|
||||
* destruction of the png_struct itself.
|
||||
|
||||
Vendored
+25
-23
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* 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;
|
||||
|
||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
||||
{
|
||||
if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
|
||||
{
|
||||
/* Invert the alpha channel (in tRNS) unless the pixels are
|
||||
* going to be expanded, in which case leave it for later
|
||||
*/
|
||||
int i, istop = png_ptr->num_trans;
|
||||
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
||||
{
|
||||
if ((png_ptr->transformations & PNG_EXPAND_tRNS) == 0)
|
||||
{
|
||||
/* Invert the alpha channel (in tRNS) unless the pixels are
|
||||
* going to be expanded, in which case leave it for later
|
||||
*/
|
||||
int i, istop = png_ptr->num_trans;
|
||||
|
||||
for (i=0; i<istop; i++)
|
||||
png_ptr->trans_alpha[i] = (png_byte)(255 -
|
||||
png_ptr->trans_alpha[i]);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < istop; i++)
|
||||
png_ptr->trans_alpha[i] =
|
||||
(png_byte)(255 - png_ptr->trans_alpha[i]);
|
||||
}
|
||||
}
|
||||
#endif /* READ_INVERT_ALPHA */
|
||||
}
|
||||
} /* background expand and (therefore) no alpha association. */
|
||||
@@ -4320,9 +4320,11 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
|
||||
* but sometimes row_info->bit_depth has been changed to 8.
|
||||
* In these cases, the palette hasn't been riffled.
|
||||
*/
|
||||
i = png_do_expand_palette_neon_rgba(png_ptr, row_info, row,
|
||||
i = png_do_expand_palette_rgba8_neon(png_ptr, row_info, row,
|
||||
&sp, &dp);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
#endif
|
||||
|
||||
for (; i < row_width; i++)
|
||||
@@ -4349,8 +4351,10 @@ png_do_expand_palette(png_structrp png_ptr, png_row_infop row_info,
|
||||
dp = row + (size_t)(row_width * 3) - 1;
|
||||
i = 0;
|
||||
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
|
||||
i = png_do_expand_palette_neon_rgb(png_ptr, row_info, row,
|
||||
i = png_do_expand_palette_rgb8_neon(png_ptr, row_info, row,
|
||||
&sp, &dp);
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
#endif
|
||||
|
||||
for (; i < row_width; i++)
|
||||
@@ -4770,19 +4774,17 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
#ifdef PNG_ARM_NEON_INTRINSICS_AVAILABLE
|
||||
if ((png_ptr->num_trans > 0) && (png_ptr->bit_depth == 8))
|
||||
{
|
||||
/* Allocate space for the decompressed full palette. */
|
||||
if (png_ptr->riffled_palette == NULL)
|
||||
{
|
||||
png_ptr->riffled_palette = png_malloc(png_ptr, 256*4);
|
||||
if (png_ptr->riffled_palette == NULL)
|
||||
png_error(png_ptr, "NULL row buffer");
|
||||
/* Build the RGBA palette. */
|
||||
png_riffle_palette_rgba(png_ptr, row_info);
|
||||
/* Initialize the accelerated palette expansion. */
|
||||
png_ptr->riffled_palette =
|
||||
(png_bytep)png_malloc(png_ptr, 256 * 4);
|
||||
png_riffle_palette_neon(png_ptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
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
|
||||
|
||||
Vendored
+2
-4
@@ -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;
|
||||
|
||||
Vendored
+7
-5
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -228,10 +228,6 @@ struct png_struct_def
|
||||
* big_row_buf; while writing it is separately
|
||||
* allocated.
|
||||
*/
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
/* Buffer to accelerate palette transformations. */
|
||||
png_bytep riffled_palette;
|
||||
#endif
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
png_bytep try_row; /* buffer to save trial row when filtering */
|
||||
png_bytep tst_row; /* buffer to save best trial row when filtering */
|
||||
@@ -396,6 +392,12 @@ struct png_struct_def
|
||||
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
|
||||
#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) */
|
||||
#if defined(PNG_MNG_FEATURES_SUPPORTED)
|
||||
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
|
||||
|
||||
Vendored
+1
-5
@@ -1,7 +1,7 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Copyright (c) 2018 Cosmin Truta
|
||||
* Copyright (c) 2018-2019 Cosmin Truta
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1996-1997 Andreas Dilger
|
||||
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
@@ -948,10 +948,6 @@ png_write_destroy(png_structrp png_ptr)
|
||||
png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
|
||||
png_free(png_ptr, png_ptr->row_buf);
|
||||
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
|
||||
png_free(png_ptr, png_ptr->prev_row);
|
||||
png_free(png_ptr, png_ptr->try_row);
|
||||
|
||||
Vendored
+5
@@ -21,6 +21,11 @@ if(ANDROID AND ARMEABI_V7A AND NOT NEON)
|
||||
endforeach()
|
||||
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
@@ -0,0 +1,30 @@
|
||||
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
-1
@@ -51,4 +51,4 @@ void WebPDeallocateAlphaMemory(VP8Decoder* const dec);
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DEC_ALPHAI_DEC_H_ */
|
||||
#endif // WEBP_DEC_ALPHAI_DEC_H_
|
||||
|
||||
+2
-1
@@ -74,7 +74,8 @@ static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) {
|
||||
} else { // RGB checks
|
||||
const WebPRGBABuffer* const buf = &buffer->u.RGBA;
|
||||
const int stride = abs(buf->stride);
|
||||
const uint64_t size = MIN_BUFFER_SIZE(width, height, stride);
|
||||
const uint64_t size =
|
||||
MIN_BUFFER_SIZE(width * kModeBpp[mode], height, stride);
|
||||
ok &= (size <= buf->size);
|
||||
ok &= (stride >= width * kModeBpp[mode]);
|
||||
ok &= (buf->rgba != NULL);
|
||||
|
||||
+1
-1
@@ -51,4 +51,4 @@ enum { MB_FEATURE_TREE_PROBS = 3,
|
||||
NUM_PROBAS = 11
|
||||
};
|
||||
|
||||
#endif // WEBP_DEC_COMMON_DEC_H_
|
||||
#endif // WEBP_DEC_COMMON_DEC_H_
|
||||
|
||||
Vendored
+1
-8
@@ -338,7 +338,6 @@ void VP8InitDithering(const WebPDecoderOptions* const options,
|
||||
for (s = 0; s < NUM_MB_SEGMENTS; ++s) {
|
||||
VP8QuantMatrix* const dqm = &dec->dqm_[s];
|
||||
if (dqm->uv_quant_ < DITHER_AMP_TAB_SIZE) {
|
||||
// TODO(skal): should we specially dither more for uv_quant_ < 0?
|
||||
const int idx = (dqm->uv_quant_ < 0) ? 0 : dqm->uv_quant_;
|
||||
dqm->dither_ = (f * kQuantToDitherAmp[idx]) >> 3;
|
||||
}
|
||||
@@ -669,15 +668,9 @@ int VP8GetThreadMethod(const WebPDecoderOptions* const options,
|
||||
(void)height;
|
||||
assert(headers == NULL || !headers->is_lossless);
|
||||
#if defined(WEBP_USE_THREAD)
|
||||
if (width < MIN_WIDTH_FOR_THREADS) return 0;
|
||||
// TODO(skal): tune the heuristic further
|
||||
#if 0
|
||||
if (height < 2 * width) return 2;
|
||||
if (width >= MIN_WIDTH_FOR_THREADS) return 2;
|
||||
#endif
|
||||
return 2;
|
||||
#else // !WEBP_USE_THREAD
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef MT_CACHE_LINES
|
||||
|
||||
Vendored
+18
-7
@@ -140,10 +140,9 @@ static void DoRemap(WebPIDecoder* const idec, ptrdiff_t offset) {
|
||||
if (NeedCompressedAlpha(idec)) {
|
||||
ALPHDecoder* const alph_dec = dec->alph_dec_;
|
||||
dec->alpha_data_ += offset;
|
||||
if (alph_dec != NULL) {
|
||||
if (alph_dec != NULL && alph_dec->vp8l_dec_ != NULL) {
|
||||
if (alph_dec->method_ == ALPHA_LOSSLESS_COMPRESSION) {
|
||||
VP8LDecoder* const alph_vp8l_dec = alph_dec->vp8l_dec_;
|
||||
assert(alph_vp8l_dec != NULL);
|
||||
assert(dec->alpha_data_size_ >= ALPHA_HEADER_LEN);
|
||||
VP8LBitReaderSetBuffer(&alph_vp8l_dec->br_,
|
||||
dec->alpha_data_ + ALPHA_HEADER_LEN,
|
||||
@@ -283,10 +282,8 @@ static void RestoreContext(const MBContext* context, VP8Decoder* const dec,
|
||||
|
||||
static VP8StatusCode IDecError(WebPIDecoder* const idec, VP8StatusCode error) {
|
||||
if (idec->state_ == STATE_VP8_DATA) {
|
||||
VP8Io* const io = &idec->io_;
|
||||
if (io->teardown != NULL) {
|
||||
io->teardown(io);
|
||||
}
|
||||
// Synchronize the thread, clean-up and check for errors.
|
||||
VP8ExitCritical((VP8Decoder*)idec->dec_, &idec->io_);
|
||||
}
|
||||
idec->state_ = STATE_ERROR;
|
||||
return error;
|
||||
@@ -451,7 +448,10 @@ static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) {
|
||||
VP8Decoder* const dec = (VP8Decoder*)idec->dec_;
|
||||
VP8Io* const io = &idec->io_;
|
||||
|
||||
assert(dec->ready_);
|
||||
// Make sure partition #0 has been read before, to set dec to ready_.
|
||||
if (!dec->ready_) {
|
||||
return IDecError(idec, VP8_STATUS_BITSTREAM_ERROR);
|
||||
}
|
||||
for (; dec->mb_y_ < dec->mb_h_; ++dec->mb_y_) {
|
||||
if (idec->last_mb_y_ != dec->mb_y_) {
|
||||
if (!VP8ParseIntraModeRow(&dec->br_, dec)) {
|
||||
@@ -473,6 +473,12 @@ static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) {
|
||||
MemDataSize(&idec->mem_) > MAX_MB_SIZE) {
|
||||
return IDecError(idec, VP8_STATUS_BITSTREAM_ERROR);
|
||||
}
|
||||
// Synchronize the threads.
|
||||
if (dec->mt_method_ > 0) {
|
||||
if (!WebPGetWorkerInterface()->Sync(&dec->worker_)) {
|
||||
return IDecError(idec, VP8_STATUS_BITSTREAM_ERROR);
|
||||
}
|
||||
}
|
||||
RestoreContext(&context, dec, token_br);
|
||||
return VP8_STATUS_SUSPENDED;
|
||||
}
|
||||
@@ -491,6 +497,7 @@ static VP8StatusCode DecodeRemaining(WebPIDecoder* const idec) {
|
||||
}
|
||||
// Synchronize the thread and check for errors.
|
||||
if (!VP8ExitCritical(dec, io)) {
|
||||
idec->state_ = STATE_ERROR; // prevent re-entry in IDecError
|
||||
return IDecError(idec, VP8_STATUS_USER_ABORT);
|
||||
}
|
||||
dec->ready_ = 0;
|
||||
@@ -571,6 +578,10 @@ static VP8StatusCode IDecode(WebPIDecoder* idec) {
|
||||
status = DecodePartition0(idec);
|
||||
}
|
||||
if (idec->state_ == STATE_VP8_DATA) {
|
||||
const VP8Decoder* const dec = (VP8Decoder*)idec->dec_;
|
||||
if (dec == NULL) {
|
||||
return VP8_STATUS_SUSPENDED; // can't continue if we have no decoder.
|
||||
}
|
||||
status = DecodeRemaining(idec);
|
||||
}
|
||||
if (idec->state_ == STATE_VP8L_HEADER) {
|
||||
|
||||
Vendored
+1
-1
@@ -182,4 +182,4 @@ WEBP_EXTERN int VP8LGetInfo(
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DEC_VP8_DEC_H_ */
|
||||
#endif // WEBP_DEC_VP8_DEC_H_
|
||||
|
||||
Vendored
+2
-2
@@ -32,7 +32,7 @@ extern "C" {
|
||||
// version numbers
|
||||
#define DEC_MAJ_VERSION 1
|
||||
#define DEC_MIN_VERSION 0
|
||||
#define DEC_REV_VERSION 0
|
||||
#define DEC_REV_VERSION 2
|
||||
|
||||
// YUV-cache parameters. Cache is 32-bytes wide (= one cacheline).
|
||||
// Constraints are: We need to store one 16x16 block of luma samples (y),
|
||||
@@ -316,4 +316,4 @@ const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DEC_VP8I_DEC_H_ */
|
||||
#endif // WEBP_DEC_VP8I_DEC_H_
|
||||
|
||||
Vendored
+78
-25
@@ -362,12 +362,19 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
|
||||
VP8LMetadata* const hdr = &dec->hdr_;
|
||||
uint32_t* huffman_image = NULL;
|
||||
HTreeGroup* htree_groups = NULL;
|
||||
// When reading htrees, some might be unused, as the format allows it.
|
||||
// We will still read them but put them in this htree_group_bogus.
|
||||
HTreeGroup htree_group_bogus;
|
||||
HuffmanCode* huffman_tables = NULL;
|
||||
HuffmanCode* huffman_tables_bogus = NULL;
|
||||
HuffmanCode* next = NULL;
|
||||
int num_htree_groups = 1;
|
||||
int num_htree_groups_max = 1;
|
||||
int max_alphabet_size = 0;
|
||||
int* code_lengths = NULL;
|
||||
const int table_size = kTableSize[color_cache_bits];
|
||||
int* mapping = NULL;
|
||||
int ok = 0;
|
||||
|
||||
if (allow_recursion && VP8LReadBits(br, 1)) {
|
||||
// use meta Huffman codes.
|
||||
@@ -384,10 +391,42 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
|
||||
// The huffman data is stored in red and green bytes.
|
||||
const int group = (huffman_image[i] >> 8) & 0xffff;
|
||||
huffman_image[i] = group;
|
||||
if (group >= num_htree_groups) {
|
||||
num_htree_groups = group + 1;
|
||||
if (group >= num_htree_groups_max) {
|
||||
num_htree_groups_max = group + 1;
|
||||
}
|
||||
}
|
||||
// Check the validity of num_htree_groups_max. If it seems too big, use a
|
||||
// smaller value for later. This will prevent big memory allocations to end
|
||||
// up with a bad bitstream anyway.
|
||||
// The value of 1000 is totally arbitrary. We know that num_htree_groups_max
|
||||
// is smaller than (1 << 16) and should be smaller than the number of pixels
|
||||
// (though the format allows it to be bigger).
|
||||
if (num_htree_groups_max > 1000 || num_htree_groups_max > xsize * ysize) {
|
||||
// Create a mapping from the used indices to the minimal set of used
|
||||
// values [0, num_htree_groups)
|
||||
mapping = (int*)WebPSafeMalloc(num_htree_groups_max, sizeof(*mapping));
|
||||
if (mapping == NULL) {
|
||||
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
// -1 means a value is unmapped, and therefore unused in the Huffman
|
||||
// image.
|
||||
memset(mapping, 0xff, num_htree_groups_max * sizeof(*mapping));
|
||||
for (num_htree_groups = 0, i = 0; i < huffman_pixs; ++i) {
|
||||
// Get the current mapping for the group and remap the Huffman image.
|
||||
int* const mapped_group = &mapping[huffman_image[i]];
|
||||
if (*mapped_group == -1) *mapped_group = num_htree_groups++;
|
||||
huffman_image[i] = *mapped_group;
|
||||
}
|
||||
huffman_tables_bogus = (HuffmanCode*)WebPSafeMalloc(
|
||||
table_size, sizeof(*huffman_tables_bogus));
|
||||
if (huffman_tables_bogus == NULL) {
|
||||
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
} else {
|
||||
num_htree_groups = num_htree_groups_max;
|
||||
}
|
||||
}
|
||||
|
||||
if (br->eos_) goto Error;
|
||||
@@ -403,11 +442,11 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
|
||||
}
|
||||
}
|
||||
|
||||
code_lengths = (int*)WebPSafeCalloc((uint64_t)max_alphabet_size,
|
||||
sizeof(*code_lengths));
|
||||
huffman_tables = (HuffmanCode*)WebPSafeMalloc(num_htree_groups * table_size,
|
||||
sizeof(*huffman_tables));
|
||||
htree_groups = VP8LHtreeGroupsNew(num_htree_groups);
|
||||
code_lengths = (int*)WebPSafeCalloc((uint64_t)max_alphabet_size,
|
||||
sizeof(*code_lengths));
|
||||
|
||||
if (htree_groups == NULL || code_lengths == NULL || huffman_tables == NULL) {
|
||||
dec->status_ = VP8_STATUS_OUT_OF_MEMORY;
|
||||
@@ -415,28 +454,35 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
|
||||
}
|
||||
|
||||
next = huffman_tables;
|
||||
for (i = 0; i < num_htree_groups; ++i) {
|
||||
HTreeGroup* const htree_group = &htree_groups[i];
|
||||
for (i = 0; i < num_htree_groups_max; ++i) {
|
||||
// If the index "i" is unused in the Huffman image, read the coefficients
|
||||
// but store them to a bogus htree_group.
|
||||
const int is_bogus = (mapping != NULL && mapping[i] == -1);
|
||||
HTreeGroup* const htree_group =
|
||||
is_bogus ? &htree_group_bogus :
|
||||
&htree_groups[(mapping == NULL) ? i : mapping[i]];
|
||||
HuffmanCode** const htrees = htree_group->htrees;
|
||||
HuffmanCode* huffman_tables_i = is_bogus ? huffman_tables_bogus : next;
|
||||
int size;
|
||||
int total_size = 0;
|
||||
int is_trivial_literal = 1;
|
||||
int max_bits = 0;
|
||||
for (j = 0; j < HUFFMAN_CODES_PER_META_CODE; ++j) {
|
||||
int alphabet_size = kAlphabetSize[j];
|
||||
htrees[j] = next;
|
||||
htrees[j] = huffman_tables_i;
|
||||
if (j == 0 && color_cache_bits > 0) {
|
||||
alphabet_size += 1 << color_cache_bits;
|
||||
}
|
||||
size = ReadHuffmanCode(alphabet_size, dec, code_lengths, next);
|
||||
size =
|
||||
ReadHuffmanCode(alphabet_size, dec, code_lengths, huffman_tables_i);
|
||||
if (size == 0) {
|
||||
goto Error;
|
||||
}
|
||||
if (is_trivial_literal && kLiteralMap[j] == 1) {
|
||||
is_trivial_literal = (next->bits == 0);
|
||||
is_trivial_literal = (huffman_tables_i->bits == 0);
|
||||
}
|
||||
total_size += next->bits;
|
||||
next += size;
|
||||
total_size += huffman_tables_i->bits;
|
||||
huffman_tables_i += size;
|
||||
if (j <= ALPHA) {
|
||||
int local_max_bits = code_lengths[0];
|
||||
int k;
|
||||
@@ -448,38 +494,41 @@ static int ReadHuffmanCodes(VP8LDecoder* const dec, int xsize, int ysize,
|
||||
max_bits += local_max_bits;
|
||||
}
|
||||
}
|
||||
if (!is_bogus) next = huffman_tables_i;
|
||||
htree_group->is_trivial_literal = is_trivial_literal;
|
||||
htree_group->is_trivial_code = 0;
|
||||
if (is_trivial_literal) {
|
||||
const int red = htrees[RED][0].value;
|
||||
const int blue = htrees[BLUE][0].value;
|
||||
const int alpha = htrees[ALPHA][0].value;
|
||||
htree_group->literal_arb =
|
||||
((uint32_t)alpha << 24) | (red << 16) | blue;
|
||||
htree_group->literal_arb = ((uint32_t)alpha << 24) | (red << 16) | blue;
|
||||
if (total_size == 0 && htrees[GREEN][0].value < NUM_LITERAL_CODES) {
|
||||
htree_group->is_trivial_code = 1;
|
||||
htree_group->literal_arb |= htrees[GREEN][0].value << 8;
|
||||
}
|
||||
}
|
||||
htree_group->use_packed_table = !htree_group->is_trivial_code &&
|
||||
(max_bits < HUFFMAN_PACKED_BITS);
|
||||
htree_group->use_packed_table =
|
||||
!htree_group->is_trivial_code && (max_bits < HUFFMAN_PACKED_BITS);
|
||||
if (htree_group->use_packed_table) BuildPackedTable(htree_group);
|
||||
}
|
||||
WebPSafeFree(code_lengths);
|
||||
ok = 1;
|
||||
|
||||
// All OK. Finalize pointers and return.
|
||||
// All OK. Finalize pointers.
|
||||
hdr->huffman_image_ = huffman_image;
|
||||
hdr->num_htree_groups_ = num_htree_groups;
|
||||
hdr->htree_groups_ = htree_groups;
|
||||
hdr->huffman_tables_ = huffman_tables;
|
||||
return 1;
|
||||
|
||||
Error:
|
||||
WebPSafeFree(code_lengths);
|
||||
WebPSafeFree(huffman_image);
|
||||
WebPSafeFree(huffman_tables);
|
||||
VP8LHtreeGroupsFree(htree_groups);
|
||||
return 0;
|
||||
WebPSafeFree(huffman_tables_bogus);
|
||||
WebPSafeFree(mapping);
|
||||
if (!ok) {
|
||||
WebPSafeFree(huffman_image);
|
||||
WebPSafeFree(huffman_tables);
|
||||
VP8LHtreeGroupsFree(htree_groups);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -884,7 +933,11 @@ static WEBP_INLINE void CopyBlock8b(uint8_t* const dst, int dist, int length) {
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
#if !defined(WORDS_BIGENDIAN)
|
||||
memcpy(&pattern, src, sizeof(uint16_t));
|
||||
#else
|
||||
pattern = ((uint32_t)src[0] << 8) | src[1];
|
||||
#endif
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
pattern |= pattern << 16;
|
||||
#elif defined(WEBP_USE_MIPS_DSP_R2)
|
||||
@@ -1523,7 +1576,6 @@ int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
|
||||
if (dec == NULL) return 0;
|
||||
|
||||
assert(alph_dec != NULL);
|
||||
alph_dec->vp8l_dec_ = dec;
|
||||
|
||||
dec->width_ = alph_dec->width_;
|
||||
dec->height_ = alph_dec->height_;
|
||||
@@ -1555,11 +1607,12 @@ int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
|
||||
|
||||
if (!ok) goto Err;
|
||||
|
||||
// Only set here, once we are sure it is valid (to avoid thread races).
|
||||
alph_dec->vp8l_dec_ = dec;
|
||||
return 1;
|
||||
|
||||
Err:
|
||||
VP8LDelete(alph_dec->vp8l_dec_);
|
||||
alph_dec->vp8l_dec_ = NULL;
|
||||
VP8LDelete(dec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -132,4 +132,4 @@ void VP8LDelete(VP8LDecoder* const dec);
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DEC_VP8LI_DEC_H_ */
|
||||
#endif // WEBP_DEC_VP8LI_DEC_H_
|
||||
|
||||
Vendored
+1
-1
@@ -130,4 +130,4 @@ int WebPAvoidSlowMemory(const WebPDecBuffer* const output,
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DEC_WEBPI_DEC_H_ */
|
||||
#endif // WEBP_DEC_WEBPI_DEC_H_
|
||||
|
||||
Vendored
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
#define DMUX_MAJ_VERSION 1
|
||||
#define DMUX_MIN_VERSION 0
|
||||
#define DMUX_REV_VERSION 0
|
||||
#define DMUX_REV_VERSION 2
|
||||
|
||||
typedef struct {
|
||||
size_t start_; // start location of the data
|
||||
|
||||
Vendored
+6
@@ -377,6 +377,7 @@ VP8SetResidualCoeffsFunc VP8SetResidualCoeffs;
|
||||
extern void VP8EncDspCostInitMIPS32(void);
|
||||
extern void VP8EncDspCostInitMIPSdspR2(void);
|
||||
extern void VP8EncDspCostInitSSE2(void);
|
||||
extern void VP8EncDspCostInitNEON(void);
|
||||
|
||||
WEBP_DSP_INIT_FUNC(VP8EncDspCostInit) {
|
||||
VP8GetResidualCost = GetResidualCost_C;
|
||||
@@ -398,6 +399,11 @@ WEBP_DSP_INIT_FUNC(VP8EncDspCostInit) {
|
||||
if (VP8GetCPUInfo(kSSE2)) {
|
||||
VP8EncDspCostInitSSE2();
|
||||
}
|
||||
#endif
|
||||
#if defined(WEBP_USE_NEON)
|
||||
if (VP8GetCPUInfo(kNEON)) {
|
||||
VP8EncDspCostInitNEON();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+122
@@ -0,0 +1,122 @@
|
||||
// Copyright 2018 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the COPYING file in the root of the source
|
||||
// tree. An additional intellectual property rights grant can be found
|
||||
// in the file PATENTS. All contributing project authors may
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// ARM NEON version of cost functions
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
|
||||
#if defined(WEBP_USE_NEON)
|
||||
|
||||
#include "src/dsp/neon.h"
|
||||
#include "src/enc/cost_enc.h"
|
||||
|
||||
static const uint8_t position[16] = { 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
|
||||
static void SetResidualCoeffs_NEON(const int16_t* const coeffs,
|
||||
VP8Residual* const res) {
|
||||
const int16x8_t minus_one = vdupq_n_s16(-1);
|
||||
const int16x8_t coeffs_0 = vld1q_s16(coeffs);
|
||||
const int16x8_t coeffs_1 = vld1q_s16(coeffs + 8);
|
||||
const uint16x8_t eob_0 = vtstq_s16(coeffs_0, minus_one);
|
||||
const uint16x8_t eob_1 = vtstq_s16(coeffs_1, minus_one);
|
||||
const uint8x16_t eob = vcombine_u8(vqmovn_u16(eob_0), vqmovn_u16(eob_1));
|
||||
const uint8x16_t masked = vandq_u8(eob, vld1q_u8(position));
|
||||
|
||||
#ifdef __aarch64__
|
||||
res->last = vmaxvq_u8(masked) - 1;
|
||||
#else
|
||||
const uint8x8_t eob_8x8 = vmax_u8(vget_low_u8(masked), vget_high_u8(masked));
|
||||
const uint16x8_t eob_16x8 = vmovl_u8(eob_8x8);
|
||||
const uint16x4_t eob_16x4 =
|
||||
vmax_u16(vget_low_u16(eob_16x8), vget_high_u16(eob_16x8));
|
||||
const uint32x4_t eob_32x4 = vmovl_u16(eob_16x4);
|
||||
uint32x2_t eob_32x2 =
|
||||
vmax_u32(vget_low_u32(eob_32x4), vget_high_u32(eob_32x4));
|
||||
eob_32x2 = vpmax_u32(eob_32x2, eob_32x2);
|
||||
|
||||
vst1_lane_s32(&res->last, vreinterpret_s32_u32(eob_32x2), 0);
|
||||
--res->last;
|
||||
#endif // __aarch64__
|
||||
|
||||
res->coeffs = coeffs;
|
||||
}
|
||||
|
||||
static int GetResidualCost_NEON(int ctx0, const VP8Residual* const res) {
|
||||
uint8_t levels[16], ctxs[16];
|
||||
uint16_t abs_levels[16];
|
||||
int n = res->first;
|
||||
// should be prob[VP8EncBands[n]], but it's equivalent for n=0 or 1
|
||||
const int p0 = res->prob[n][ctx0][0];
|
||||
CostArrayPtr const costs = res->costs;
|
||||
const uint16_t* t = costs[n][ctx0];
|
||||
// bit_cost(1, p0) is already incorporated in t[] tables, but only if ctx != 0
|
||||
// (as required by the syntax). For ctx0 == 0, we need to add it here or it'll
|
||||
// be missing during the loop.
|
||||
int cost = (ctx0 == 0) ? VP8BitCost(1, p0) : 0;
|
||||
|
||||
if (res->last < 0) {
|
||||
return VP8BitCost(0, p0);
|
||||
}
|
||||
|
||||
{ // precompute clamped levels and contexts, packed to 8b.
|
||||
const uint8x16_t kCst2 = vdupq_n_u8(2);
|
||||
const uint8x16_t kCst67 = vdupq_n_u8(MAX_VARIABLE_LEVEL);
|
||||
const int16x8_t c0 = vld1q_s16(res->coeffs);
|
||||
const int16x8_t c1 = vld1q_s16(res->coeffs + 8);
|
||||
const uint16x8_t E0 = vreinterpretq_u16_s16(vabsq_s16(c0));
|
||||
const uint16x8_t E1 = vreinterpretq_u16_s16(vabsq_s16(c1));
|
||||
const uint8x16_t F = vcombine_u8(vqmovn_u16(E0), vqmovn_u16(E1));
|
||||
const uint8x16_t G = vminq_u8(F, kCst2); // context = 0,1,2
|
||||
const uint8x16_t H = vminq_u8(F, kCst67); // clamp_level in [0..67]
|
||||
|
||||
vst1q_u8(ctxs, G);
|
||||
vst1q_u8(levels, H);
|
||||
|
||||
vst1q_u16(abs_levels, E0);
|
||||
vst1q_u16(abs_levels + 8, E1);
|
||||
}
|
||||
for (; n < res->last; ++n) {
|
||||
const int ctx = ctxs[n];
|
||||
const int level = levels[n];
|
||||
const int flevel = abs_levels[n]; // full level
|
||||
cost += VP8LevelFixedCosts[flevel] + t[level]; // simplified VP8LevelCost()
|
||||
t = costs[n + 1][ctx];
|
||||
}
|
||||
// Last coefficient is always non-zero
|
||||
{
|
||||
const int level = levels[n];
|
||||
const int flevel = abs_levels[n];
|
||||
assert(flevel != 0);
|
||||
cost += VP8LevelFixedCosts[flevel] + t[level];
|
||||
if (n < 15) {
|
||||
const int b = VP8EncBands[n + 1];
|
||||
const int ctx = ctxs[n];
|
||||
const int last_p0 = res->prob[b][ctx][0];
|
||||
cost += VP8BitCost(0, last_p0);
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
|
||||
extern void VP8EncDspCostInitNEON(void);
|
||||
|
||||
WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspCostInitNEON(void) {
|
||||
VP8SetResidualCoeffs = SetResidualCoeffs_NEON;
|
||||
VP8GetResidualCost = GetResidualCost_NEON;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_NEON
|
||||
|
||||
WEBP_DSP_INIT_STUB(VP8EncDspCostInitNEON)
|
||||
|
||||
#endif // WEBP_USE_NEON
|
||||
Vendored
+1
-5
@@ -76,10 +76,6 @@ extern "C" {
|
||||
#define WEBP_USE_SSE41
|
||||
#endif
|
||||
|
||||
#if defined(__AVX2__) || defined(WEBP_HAVE_AVX2)
|
||||
#define WEBP_USE_AVX2
|
||||
#endif
|
||||
|
||||
// The intrinsics currently cause compiler errors with arm-nacl-gcc and the
|
||||
// inline assembly would need to be modified for use with Native Client.
|
||||
#if (defined(__ARM_NEON__) || \
|
||||
@@ -679,4 +675,4 @@ void VP8FiltersInit(void);
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DSP_DSP_H_ */
|
||||
#endif // WEBP_DSP_DSP_H_
|
||||
|
||||
Vendored
-6
@@ -734,7 +734,6 @@ VP8BlockCopy VP8Copy16x8;
|
||||
|
||||
extern void VP8EncDspInitSSE2(void);
|
||||
extern void VP8EncDspInitSSE41(void);
|
||||
extern void VP8EncDspInitAVX2(void);
|
||||
extern void VP8EncDspInitNEON(void);
|
||||
extern void VP8EncDspInitMIPS32(void);
|
||||
extern void VP8EncDspInitMIPSdspR2(void);
|
||||
@@ -784,11 +783,6 @@ WEBP_DSP_INIT_FUNC(VP8EncDspInit) {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(WEBP_USE_AVX2)
|
||||
if (VP8GetCPUInfo(kAVX2)) {
|
||||
VP8EncDspInitAVX2();
|
||||
}
|
||||
#endif
|
||||
#if defined(WEBP_USE_MIPS32)
|
||||
if (VP8GetCPUInfo(kMIPS32)) {
|
||||
VP8EncDspInitMIPS32();
|
||||
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the COPYING file in the root of the source
|
||||
// tree. An additional intellectual property rights grant can be found
|
||||
// in the file PATENTS. All contributing project authors may
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// AVX2 version of speed-critical encoding functions.
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
|
||||
#if defined(WEBP_USE_AVX2)
|
||||
|
||||
#endif // WEBP_USE_AVX2
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
|
||||
WEBP_DSP_INIT_STUB(VP8EncDspInitAVX2)
|
||||
Vendored
-2
@@ -23,8 +23,6 @@
|
||||
#include "src/dsp/lossless.h"
|
||||
#include "src/dsp/lossless_common.h"
|
||||
|
||||
#define MAX_DIFF_COST (1e30f)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Image transforms.
|
||||
|
||||
|
||||
Vendored
+9
-5
@@ -163,7 +163,7 @@ extern VP8LCostCombinedFunc VP8LExtraCostCombined;
|
||||
extern VP8LCombinedShannonEntropyFunc VP8LCombinedShannonEntropy;
|
||||
|
||||
typedef struct { // small struct to hold counters
|
||||
int counts[2]; // index: 0=zero steak, 1=non-zero streak
|
||||
int counts[2]; // index: 0=zero streak, 1=non-zero streak
|
||||
int streaks[2][2]; // [zero/non-zero][streak<3 / streak>=3]
|
||||
} VP8LStreaks;
|
||||
|
||||
@@ -194,10 +194,14 @@ extern VP8LGetEntropyUnrefinedFunc VP8LGetEntropyUnrefined;
|
||||
void VP8LBitsEntropyUnrefined(const uint32_t* const array, int n,
|
||||
VP8LBitEntropy* const entropy);
|
||||
|
||||
typedef void (*VP8LHistogramAddFunc)(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
VP8LHistogram* const out);
|
||||
extern VP8LHistogramAddFunc VP8LHistogramAdd;
|
||||
typedef void (*VP8LAddVectorFunc)(const uint32_t* a, const uint32_t* b,
|
||||
uint32_t* out, int size);
|
||||
extern VP8LAddVectorFunc VP8LAddVector;
|
||||
typedef void (*VP8LAddVectorEqFunc)(const uint32_t* a, uint32_t* out, int size);
|
||||
extern VP8LAddVectorEqFunc VP8LAddVectorEq;
|
||||
void VP8LHistogramAdd(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
VP8LHistogram* const out);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// PrefixEncode()
|
||||
|
||||
+59
-27
@@ -632,38 +632,67 @@ static double ExtraCostCombined_C(const uint32_t* X, const uint32_t* Y,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void HistogramAdd_C(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
VP8LHistogram* const out) {
|
||||
static void AddVector_C(const uint32_t* a, const uint32_t* b, uint32_t* out,
|
||||
int size) {
|
||||
int i;
|
||||
for (i = 0; i < size; ++i) out[i] = a[i] + b[i];
|
||||
}
|
||||
|
||||
static void AddVectorEq_C(const uint32_t* a, uint32_t* out, int size) {
|
||||
int i;
|
||||
for (i = 0; i < size; ++i) out[i] += a[i];
|
||||
}
|
||||
|
||||
#define ADD(X, ARG, LEN) do { \
|
||||
if (a->is_used_[X]) { \
|
||||
if (b->is_used_[X]) { \
|
||||
VP8LAddVector(a->ARG, b->ARG, out->ARG, (LEN)); \
|
||||
} else { \
|
||||
memcpy(&out->ARG[0], &a->ARG[0], (LEN) * sizeof(out->ARG[0])); \
|
||||
} \
|
||||
} else if (b->is_used_[X]) { \
|
||||
memcpy(&out->ARG[0], &b->ARG[0], (LEN) * sizeof(out->ARG[0])); \
|
||||
} else { \
|
||||
memset(&out->ARG[0], 0, (LEN) * sizeof(out->ARG[0])); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ADD_EQ(X, ARG, LEN) do { \
|
||||
if (a->is_used_[X]) { \
|
||||
if (out->is_used_[X]) { \
|
||||
VP8LAddVectorEq(a->ARG, out->ARG, (LEN)); \
|
||||
} else { \
|
||||
memcpy(&out->ARG[0], &a->ARG[0], (LEN) * sizeof(out->ARG[0])); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void VP8LHistogramAdd(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b, VP8LHistogram* const out) {
|
||||
int i;
|
||||
const int literal_size = VP8LHistogramNumCodes(a->palette_code_bits_);
|
||||
assert(a->palette_code_bits_ == b->palette_code_bits_);
|
||||
|
||||
if (b != out) {
|
||||
for (i = 0; i < literal_size; ++i) {
|
||||
out->literal_[i] = a->literal_[i] + b->literal_[i];
|
||||
}
|
||||
for (i = 0; i < NUM_DISTANCE_CODES; ++i) {
|
||||
out->distance_[i] = a->distance_[i] + b->distance_[i];
|
||||
}
|
||||
for (i = 0; i < NUM_LITERAL_CODES; ++i) {
|
||||
out->red_[i] = a->red_[i] + b->red_[i];
|
||||
out->blue_[i] = a->blue_[i] + b->blue_[i];
|
||||
out->alpha_[i] = a->alpha_[i] + b->alpha_[i];
|
||||
ADD(0, literal_, literal_size);
|
||||
ADD(1, red_, NUM_LITERAL_CODES);
|
||||
ADD(2, blue_, NUM_LITERAL_CODES);
|
||||
ADD(3, alpha_, NUM_LITERAL_CODES);
|
||||
ADD(4, distance_, NUM_DISTANCE_CODES);
|
||||
for (i = 0; i < 5; ++i) {
|
||||
out->is_used_[i] = (a->is_used_[i] | b->is_used_[i]);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < literal_size; ++i) {
|
||||
out->literal_[i] += a->literal_[i];
|
||||
}
|
||||
for (i = 0; i < NUM_DISTANCE_CODES; ++i) {
|
||||
out->distance_[i] += a->distance_[i];
|
||||
}
|
||||
for (i = 0; i < NUM_LITERAL_CODES; ++i) {
|
||||
out->red_[i] += a->red_[i];
|
||||
out->blue_[i] += a->blue_[i];
|
||||
out->alpha_[i] += a->alpha_[i];
|
||||
}
|
||||
ADD_EQ(0, literal_, literal_size);
|
||||
ADD_EQ(1, red_, NUM_LITERAL_CODES);
|
||||
ADD_EQ(2, blue_, NUM_LITERAL_CODES);
|
||||
ADD_EQ(3, alpha_, NUM_LITERAL_CODES);
|
||||
ADD_EQ(4, distance_, NUM_DISTANCE_CODES);
|
||||
for (i = 0; i < 5; ++i) out->is_used_[i] |= a->is_used_[i];
|
||||
}
|
||||
}
|
||||
#undef ADD
|
||||
#undef ADD_EQ
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Image transforms.
|
||||
@@ -848,7 +877,8 @@ VP8LCombinedShannonEntropyFunc VP8LCombinedShannonEntropy;
|
||||
VP8LGetEntropyUnrefinedFunc VP8LGetEntropyUnrefined;
|
||||
VP8LGetCombinedEntropyUnrefinedFunc VP8LGetCombinedEntropyUnrefined;
|
||||
|
||||
VP8LHistogramAddFunc VP8LHistogramAdd;
|
||||
VP8LAddVectorFunc VP8LAddVector;
|
||||
VP8LAddVectorEqFunc VP8LAddVectorEq;
|
||||
|
||||
VP8LVectorMismatchFunc VP8LVectorMismatch;
|
||||
VP8LBundleColorMapFunc VP8LBundleColorMap;
|
||||
@@ -885,7 +915,8 @@ WEBP_DSP_INIT_FUNC(VP8LEncDspInit) {
|
||||
VP8LGetEntropyUnrefined = GetEntropyUnrefined_C;
|
||||
VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined_C;
|
||||
|
||||
VP8LHistogramAdd = HistogramAdd_C;
|
||||
VP8LAddVector = AddVector_C;
|
||||
VP8LAddVectorEq = AddVectorEq_C;
|
||||
|
||||
VP8LVectorMismatch = VectorMismatch_C;
|
||||
VP8LBundleColorMap = VP8LBundleColorMap_C;
|
||||
@@ -971,7 +1002,8 @@ WEBP_DSP_INIT_FUNC(VP8LEncDspInit) {
|
||||
assert(VP8LCombinedShannonEntropy != NULL);
|
||||
assert(VP8LGetEntropyUnrefined != NULL);
|
||||
assert(VP8LGetCombinedEntropyUnrefined != NULL);
|
||||
assert(VP8LHistogramAdd != NULL);
|
||||
assert(VP8LAddVector != NULL);
|
||||
assert(VP8LAddVectorEq != NULL);
|
||||
assert(VP8LVectorMismatch != NULL);
|
||||
assert(VP8LBundleColorMap != NULL);
|
||||
assert(VP8LPredictorsSub[0] != NULL);
|
||||
|
||||
+22
-57
@@ -344,65 +344,29 @@ static void GetCombinedEntropyUnrefined_MIPS32(const uint32_t X[],
|
||||
ASM_END_COMMON_0 \
|
||||
ASM_END_COMMON_1
|
||||
|
||||
#define ADD_VECTOR(A, B, OUT, SIZE, EXTRA_SIZE) do { \
|
||||
const uint32_t* pa = (const uint32_t*)(A); \
|
||||
const uint32_t* pb = (const uint32_t*)(B); \
|
||||
uint32_t* pout = (uint32_t*)(OUT); \
|
||||
const uint32_t* const LoopEnd = pa + (SIZE); \
|
||||
assert((SIZE) % 4 == 0); \
|
||||
ASM_START \
|
||||
ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout) \
|
||||
ASM_END_0 \
|
||||
if ((EXTRA_SIZE) > 0) { \
|
||||
const int last = (EXTRA_SIZE); \
|
||||
int i; \
|
||||
for (i = 0; i < last; ++i) pout[i] = pa[i] + pb[i]; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ADD_VECTOR_EQ(A, OUT, SIZE, EXTRA_SIZE) do { \
|
||||
const uint32_t* pa = (const uint32_t*)(A); \
|
||||
uint32_t* pout = (uint32_t*)(OUT); \
|
||||
const uint32_t* const LoopEnd = pa + (SIZE); \
|
||||
assert((SIZE) % 4 == 0); \
|
||||
ASM_START \
|
||||
ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout) \
|
||||
ASM_END_1 \
|
||||
if ((EXTRA_SIZE) > 0) { \
|
||||
const int last = (EXTRA_SIZE); \
|
||||
int i; \
|
||||
for (i = 0; i < last; ++i) pout[i] += pa[i]; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static void HistogramAdd_MIPS32(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
VP8LHistogram* const out) {
|
||||
static void AddVector_MIPS32(const uint32_t* pa, const uint32_t* pb,
|
||||
uint32_t* pout, int size) {
|
||||
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||
const int extra_cache_size = VP8LHistogramNumCodes(a->palette_code_bits_)
|
||||
- (NUM_LITERAL_CODES + NUM_LENGTH_CODES);
|
||||
assert(a->palette_code_bits_ == b->palette_code_bits_);
|
||||
|
||||
if (b != out) {
|
||||
ADD_VECTOR(a->literal_, b->literal_, out->literal_,
|
||||
NUM_LITERAL_CODES + NUM_LENGTH_CODES, extra_cache_size);
|
||||
ADD_VECTOR(a->distance_, b->distance_, out->distance_,
|
||||
NUM_DISTANCE_CODES, 0);
|
||||
ADD_VECTOR(a->red_, b->red_, out->red_, NUM_LITERAL_CODES, 0);
|
||||
ADD_VECTOR(a->blue_, b->blue_, out->blue_, NUM_LITERAL_CODES, 0);
|
||||
ADD_VECTOR(a->alpha_, b->alpha_, out->alpha_, NUM_LITERAL_CODES, 0);
|
||||
} else {
|
||||
ADD_VECTOR_EQ(a->literal_, out->literal_,
|
||||
NUM_LITERAL_CODES + NUM_LENGTH_CODES, extra_cache_size);
|
||||
ADD_VECTOR_EQ(a->distance_, out->distance_, NUM_DISTANCE_CODES, 0);
|
||||
ADD_VECTOR_EQ(a->red_, out->red_, NUM_LITERAL_CODES, 0);
|
||||
ADD_VECTOR_EQ(a->blue_, out->blue_, NUM_LITERAL_CODES, 0);
|
||||
ADD_VECTOR_EQ(a->alpha_, out->alpha_, NUM_LITERAL_CODES, 0);
|
||||
}
|
||||
const uint32_t end = ((size) / 4) * 4;
|
||||
const uint32_t* const LoopEnd = pa + end;
|
||||
int i;
|
||||
ASM_START
|
||||
ADD_TO_OUT(0, 4, 8, 12, 1, pa, pb, pout)
|
||||
ASM_END_0
|
||||
for (i = end; i < size; ++i) pout[i] = pa[i] + pb[i];
|
||||
}
|
||||
|
||||
static void AddVectorEq_MIPS32(const uint32_t* pa, uint32_t* pout, int size) {
|
||||
uint32_t temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
|
||||
const uint32_t end = ((size) / 4) * 4;
|
||||
const uint32_t* const LoopEnd = pa + end;
|
||||
int i;
|
||||
ASM_START
|
||||
ADD_TO_OUT(0, 4, 8, 12, 0, pa, pout, pout)
|
||||
ASM_END_1
|
||||
for (i = end; i < size; ++i) pout[i] += pa[i];
|
||||
}
|
||||
|
||||
#undef ADD_VECTOR_EQ
|
||||
#undef ADD_VECTOR
|
||||
#undef ASM_END_1
|
||||
#undef ASM_END_0
|
||||
#undef ASM_END_COMMON_1
|
||||
@@ -422,7 +386,8 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitMIPS32(void) {
|
||||
VP8LExtraCostCombined = ExtraCostCombined_MIPS32;
|
||||
VP8LGetEntropyUnrefined = GetEntropyUnrefined_MIPS32;
|
||||
VP8LGetCombinedEntropyUnrefined = GetCombinedEntropyUnrefined_MIPS32;
|
||||
VP8LHistogramAdd = HistogramAdd_MIPS32;
|
||||
VP8LAddVector = AddVector_MIPS32;
|
||||
VP8LAddVectorEq = AddVectorEq_MIPS32;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_MIPS32
|
||||
|
||||
+12
-32
@@ -170,12 +170,13 @@ static void CollectColorRedTransforms_SSE2(const uint32_t* argb, int stride,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Note we are adding uint32_t's as *signed* int32's (using _mm_add_epi32). But
|
||||
// that's ok since the histogram values are less than 1<<28 (max picture size).
|
||||
#define LINE_SIZE 16 // 8 or 16
|
||||
static void AddVector_SSE2(const uint32_t* a, const uint32_t* b, uint32_t* out,
|
||||
int size) {
|
||||
int i;
|
||||
assert(size % LINE_SIZE == 0);
|
||||
for (i = 0; i < size; i += LINE_SIZE) {
|
||||
for (i = 0; i + LINE_SIZE <= size; i += LINE_SIZE) {
|
||||
const __m128i a0 = _mm_loadu_si128((const __m128i*)&a[i + 0]);
|
||||
const __m128i a1 = _mm_loadu_si128((const __m128i*)&a[i + 4]);
|
||||
#if (LINE_SIZE == 16)
|
||||
@@ -195,12 +196,14 @@ static void AddVector_SSE2(const uint32_t* a, const uint32_t* b, uint32_t* out,
|
||||
_mm_storeu_si128((__m128i*)&out[i + 12], _mm_add_epi32(a3, b3));
|
||||
#endif
|
||||
}
|
||||
for (; i < size; ++i) {
|
||||
out[i] = a[i] + b[i];
|
||||
}
|
||||
}
|
||||
|
||||
static void AddVectorEq_SSE2(const uint32_t* a, uint32_t* out, int size) {
|
||||
int i;
|
||||
assert(size % LINE_SIZE == 0);
|
||||
for (i = 0; i < size; i += LINE_SIZE) {
|
||||
for (i = 0; i + LINE_SIZE <= size; i += LINE_SIZE) {
|
||||
const __m128i a0 = _mm_loadu_si128((const __m128i*)&a[i + 0]);
|
||||
const __m128i a1 = _mm_loadu_si128((const __m128i*)&a[i + 4]);
|
||||
#if (LINE_SIZE == 16)
|
||||
@@ -220,36 +223,12 @@ static void AddVectorEq_SSE2(const uint32_t* a, uint32_t* out, int size) {
|
||||
_mm_storeu_si128((__m128i*)&out[i + 12], _mm_add_epi32(a3, b3));
|
||||
#endif
|
||||
}
|
||||
for (; i < size; ++i) {
|
||||
out[i] += a[i];
|
||||
}
|
||||
}
|
||||
#undef LINE_SIZE
|
||||
|
||||
// Note we are adding uint32_t's as *signed* int32's (using _mm_add_epi32). But
|
||||
// that's ok since the histogram values are less than 1<<28 (max picture size).
|
||||
static void HistogramAdd_SSE2(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
VP8LHistogram* const out) {
|
||||
int i;
|
||||
const int literal_size = VP8LHistogramNumCodes(a->palette_code_bits_);
|
||||
assert(a->palette_code_bits_ == b->palette_code_bits_);
|
||||
if (b != out) {
|
||||
AddVector_SSE2(a->literal_, b->literal_, out->literal_, NUM_LITERAL_CODES);
|
||||
AddVector_SSE2(a->red_, b->red_, out->red_, NUM_LITERAL_CODES);
|
||||
AddVector_SSE2(a->blue_, b->blue_, out->blue_, NUM_LITERAL_CODES);
|
||||
AddVector_SSE2(a->alpha_, b->alpha_, out->alpha_, NUM_LITERAL_CODES);
|
||||
} else {
|
||||
AddVectorEq_SSE2(a->literal_, out->literal_, NUM_LITERAL_CODES);
|
||||
AddVectorEq_SSE2(a->red_, out->red_, NUM_LITERAL_CODES);
|
||||
AddVectorEq_SSE2(a->blue_, out->blue_, NUM_LITERAL_CODES);
|
||||
AddVectorEq_SSE2(a->alpha_, out->alpha_, NUM_LITERAL_CODES);
|
||||
}
|
||||
for (i = NUM_LITERAL_CODES; i < literal_size; ++i) {
|
||||
out->literal_[i] = a->literal_[i] + b->literal_[i];
|
||||
}
|
||||
for (i = 0; i < NUM_DISTANCE_CODES; ++i) {
|
||||
out->distance_[i] = a->distance_[i] + b->distance_[i];
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entropy
|
||||
|
||||
@@ -675,7 +654,8 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8LEncDspInitSSE2(void) {
|
||||
VP8LTransformColor = TransformColor_SSE2;
|
||||
VP8LCollectColorBlueTransforms = CollectColorBlueTransforms_SSE2;
|
||||
VP8LCollectColorRedTransforms = CollectColorRedTransforms_SSE2;
|
||||
VP8LHistogramAdd = HistogramAdd_SSE2;
|
||||
VP8LAddVector = AddVector_SSE2;
|
||||
VP8LAddVectorEq = AddVectorEq_SSE2;
|
||||
VP8LCombinedShannonEntropy = CombinedShannonEntropy_SSE2;
|
||||
VP8LVectorMismatch = VectorMismatch_SSE2;
|
||||
VP8LBundleColorMap = BundleColorMap_SSE2;
|
||||
|
||||
Vendored
+1
-1
@@ -1389,4 +1389,4 @@ static WEBP_INLINE uint32_t func_hadd_uh_u32(v8u16 in) {
|
||||
} while (0)
|
||||
#define AVER_UB2_UB(...) AVER_UB2(v16u8, __VA_ARGS__)
|
||||
|
||||
#endif /* WEBP_DSP_MSA_MACRO_H_ */
|
||||
#endif // WEBP_DSP_MSA_MACRO_H_
|
||||
|
||||
Vendored
+70
@@ -0,0 +1,70 @@
|
||||
// Copyright 2018 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style license
|
||||
// that can be found in the COPYING file in the root of the source
|
||||
// tree. An additional intellectual property rights grant can be found
|
||||
// in the file PATENTS. All contributing project authors may
|
||||
// be found in the AUTHORS file in the root of the source tree.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifndef WEBP_DSP_QUANT_H_
|
||||
#define WEBP_DSP_QUANT_H_
|
||||
|
||||
#include "src/dsp/dsp.h"
|
||||
#include "src/webp/types.h"
|
||||
|
||||
#if defined(WEBP_USE_NEON) && !defined(WEBP_ANDROID_NEON) && \
|
||||
!defined(WEBP_HAVE_NEON_RTCD)
|
||||
#include <arm_neon.h>
|
||||
|
||||
#define IsFlat IsFlat_NEON
|
||||
|
||||
static uint32x2_t horizontal_add_uint32x4(const uint32x4_t a) {
|
||||
const uint64x2_t b = vpaddlq_u32(a);
|
||||
return vadd_u32(vreinterpret_u32_u64(vget_low_u64(b)),
|
||||
vreinterpret_u32_u64(vget_high_u64(b)));
|
||||
}
|
||||
|
||||
static WEBP_INLINE int IsFlat(const int16_t* levels, int num_blocks,
|
||||
int thresh) {
|
||||
const int16x8_t tst_ones = vdupq_n_s16(-1);
|
||||
uint32x4_t sum = vdupq_n_u32(0);
|
||||
|
||||
for (int i = 0; i < num_blocks; ++i) {
|
||||
// Set DC to zero.
|
||||
const int16x8_t a_0 = vsetq_lane_s16(0, vld1q_s16(levels), 0);
|
||||
const int16x8_t a_1 = vld1q_s16(levels + 8);
|
||||
|
||||
const uint16x8_t b_0 = vshrq_n_u16(vtstq_s16(a_0, tst_ones), 15);
|
||||
const uint16x8_t b_1 = vshrq_n_u16(vtstq_s16(a_1, tst_ones), 15);
|
||||
|
||||
sum = vpadalq_u16(sum, b_0);
|
||||
sum = vpadalq_u16(sum, b_1);
|
||||
|
||||
levels += 16;
|
||||
}
|
||||
return thresh >= (int32_t)vget_lane_u32(horizontal_add_uint32x4(sum), 0);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define IsFlat IsFlat_C
|
||||
|
||||
static WEBP_INLINE int IsFlat(const int16_t* levels, int num_blocks,
|
||||
int thresh) {
|
||||
int score = 0;
|
||||
while (num_blocks-- > 0) { // TODO(skal): refine positional scoring?
|
||||
int i;
|
||||
for (i = 1; i < 16; ++i) { // omit DC, we're only interested in AC
|
||||
score += (levels[i] != 0);
|
||||
if (score > thresh) return 0;
|
||||
}
|
||||
levels += 16;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // defined(WEBP_USE_NEON) && !defined(WEBP_ANDROID_NEON) &&
|
||||
// !defined(WEBP_HAVE_NEON_RTCD)
|
||||
|
||||
#endif // WEBP_DSP_QUANT_H_
|
||||
Vendored
+3
-1
@@ -21,6 +21,7 @@
|
||||
|
||||
#define ROUNDER (WEBP_RESCALER_ONE >> 1)
|
||||
#define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Row import
|
||||
@@ -138,7 +139,7 @@ void WebPRescalerExportRowShrink_C(WebPRescaler* const wrk) {
|
||||
if (yscale) {
|
||||
for (x_out = 0; x_out < x_out_max; ++x_out) {
|
||||
const uint32_t frac = (uint32_t)MULT_FIX(frow[x_out], yscale);
|
||||
const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale);
|
||||
const int v = (int)MULT_FIX_FLOOR(irow[x_out] - frac, wrk->fxy_scale);
|
||||
assert(v >= 0 && v <= 255);
|
||||
dst[x_out] = v;
|
||||
irow[x_out] = frac; // new fractional start
|
||||
@@ -153,6 +154,7 @@ void WebPRescalerExportRowShrink_C(WebPRescaler* const wrk) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef MULT_FIX_FLOOR
|
||||
#undef MULT_FIX
|
||||
#undef ROUNDER
|
||||
|
||||
|
||||
+3
-1
@@ -209,6 +209,7 @@ static void ExportRowExpand_MIPS32(WebPRescaler* const wrk) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // disabled for now. TODO(skal): make match the C-code
|
||||
static void ExportRowShrink_MIPS32(WebPRescaler* const wrk) {
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
uint8_t* dst = wrk->dst;
|
||||
@@ -273,6 +274,7 @@ static void ExportRowShrink_MIPS32(WebPRescaler* const wrk) {
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
@@ -283,7 +285,7 @@ WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPS32(void) {
|
||||
WebPRescalerImportRowExpand = ImportRowExpand_MIPS32;
|
||||
WebPRescalerImportRowShrink = ImportRowShrink_MIPS32;
|
||||
WebPRescalerExportRowExpand = ExportRowExpand_MIPS32;
|
||||
WebPRescalerExportRowShrink = ExportRowShrink_MIPS32;
|
||||
// WebPRescalerExportRowShrink = ExportRowShrink_MIPS32;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_MIPS32
|
||||
|
||||
+7
-3
@@ -20,10 +20,12 @@
|
||||
|
||||
#define ROUNDER (WEBP_RESCALER_ONE >> 1)
|
||||
#define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Row export
|
||||
|
||||
#if 0 // disabled for now. TODO(skal): make match the C-code
|
||||
static void ExportRowShrink_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
int i;
|
||||
const int x_out_max = wrk->dst_width * wrk->num_channels;
|
||||
@@ -106,7 +108,7 @@ static void ExportRowShrink_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
}
|
||||
for (i = 0; i < (x_out_max & 0x3); ++i) {
|
||||
const uint32_t frac = (uint32_t)MULT_FIX(*frow++, yscale);
|
||||
const int v = (int)MULT_FIX(*irow - frac, wrk->fxy_scale);
|
||||
const int v = (int)MULT_FIX_FLOOR(*irow - frac, wrk->fxy_scale);
|
||||
assert(v >= 0 && v <= 255);
|
||||
*dst++ = v;
|
||||
*irow++ = frac; // new fractional start
|
||||
@@ -154,13 +156,14 @@ static void ExportRowShrink_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
);
|
||||
}
|
||||
for (i = 0; i < (x_out_max & 0x3); ++i) {
|
||||
const int v = (int)MULT_FIX(*irow, wrk->fxy_scale);
|
||||
const int v = (int)MULT_FIX_FLOOR(*irow, wrk->fxy_scale);
|
||||
assert(v >= 0 && v <= 255);
|
||||
*dst++ = v;
|
||||
*irow++ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
static void ExportRowExpand_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
int i;
|
||||
@@ -294,6 +297,7 @@ static void ExportRowExpand_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef MULT_FIX_FLOOR
|
||||
#undef MULT_FIX
|
||||
#undef ROUNDER
|
||||
|
||||
@@ -304,7 +308,7 @@ extern void WebPRescalerDspInitMIPSdspR2(void);
|
||||
|
||||
WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMIPSdspR2(void) {
|
||||
WebPRescalerExportRowExpand = ExportRowExpand_MIPSdspR2;
|
||||
WebPRescalerExportRowShrink = ExportRowShrink_MIPSdspR2;
|
||||
// WebPRescalerExportRowShrink = ExportRowShrink_MIPSdspR2;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_MIPS_DSP_R2
|
||||
|
||||
+5
-2
@@ -22,6 +22,7 @@
|
||||
|
||||
#define ROUNDER (WEBP_RESCALER_ONE >> 1)
|
||||
#define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX)
|
||||
|
||||
#define CALC_MULT_FIX_16(in0, in1, in2, in3, scale, shift, dst) do { \
|
||||
v4u32 tmp0, tmp1, tmp2, tmp3; \
|
||||
@@ -262,6 +263,7 @@ static void RescalerExportRowExpand_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // disabled for now. TODO(skal): make match the C-code
|
||||
static WEBP_INLINE void ExportRowShrink_0(const uint32_t* frow, uint32_t* irow,
|
||||
uint8_t* dst, int length,
|
||||
const uint32_t yscale,
|
||||
@@ -341,7 +343,7 @@ static WEBP_INLINE void ExportRowShrink_0(const uint32_t* frow, uint32_t* irow,
|
||||
}
|
||||
for (x_out = 0; x_out < length; ++x_out) {
|
||||
const uint32_t frac = (uint32_t)MULT_FIX(frow[x_out], yscale);
|
||||
const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale);
|
||||
const int v = (int)MULT_FIX_FLOOR(irow[x_out] - frac, wrk->fxy_scale);
|
||||
assert(v >= 0 && v <= 255);
|
||||
dst[x_out] = v;
|
||||
irow[x_out] = frac;
|
||||
@@ -426,6 +428,7 @@ static void RescalerExportRowShrink_MIPSdspR2(WebPRescaler* const wrk) {
|
||||
ExportRowShrink_1(irow, dst, x_out_max, wrk);
|
||||
}
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point
|
||||
@@ -434,7 +437,7 @@ extern void WebPRescalerDspInitMSA(void);
|
||||
|
||||
WEBP_TSAN_IGNORE_FUNCTION void WebPRescalerDspInitMSA(void) {
|
||||
WebPRescalerExportRowExpand = RescalerExportRowExpand_MIPSdspR2;
|
||||
WebPRescalerExportRowShrink = RescalerExportRowShrink_MIPSdspR2;
|
||||
// WebPRescalerExportRowShrink = RescalerExportRowShrink_MIPSdspR2;
|
||||
}
|
||||
|
||||
#else // !WEBP_USE_MSA
|
||||
|
||||
+14
-4
@@ -22,6 +22,7 @@
|
||||
|
||||
#define ROUNDER (WEBP_RESCALER_ONE >> 1)
|
||||
#define MULT_FIX_C(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
#define MULT_FIX_FLOOR_C(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX)
|
||||
|
||||
#define LOAD_32x4(SRC, DST) const uint32x4_t DST = vld1q_u32((SRC))
|
||||
#define LOAD_32x8(SRC, DST0, DST1) \
|
||||
@@ -35,8 +36,11 @@
|
||||
|
||||
#if (WEBP_RESCALER_RFIX == 32)
|
||||
#define MAKE_HALF_CST(C) vdupq_n_s32((int32_t)((C) >> 1))
|
||||
#define MULT_FIX(A, B) /* note: B is actualy scale>>1. See MAKE_HALF_CST */ \
|
||||
// note: B is actualy scale>>1. See MAKE_HALF_CST
|
||||
#define MULT_FIX(A, B) \
|
||||
vreinterpretq_u32_s32(vqrdmulhq_s32(vreinterpretq_s32_u32((A)), (B)))
|
||||
#define MULT_FIX_FLOOR(A, B) \
|
||||
vreinterpretq_u32_s32(vqdmulhq_s32(vreinterpretq_s32_u32((A)), (B)))
|
||||
#else
|
||||
#error "MULT_FIX/WEBP_RESCALER_RFIX need some more work"
|
||||
#endif
|
||||
@@ -135,8 +139,8 @@ static void RescalerExportRowShrink_NEON(WebPRescaler* const wrk) {
|
||||
const uint32x4_t A1 = MULT_FIX(in1, yscale_half);
|
||||
const uint32x4_t B0 = vqsubq_u32(in2, A0);
|
||||
const uint32x4_t B1 = vqsubq_u32(in3, A1);
|
||||
const uint32x4_t C0 = MULT_FIX(B0, fxy_scale_half);
|
||||
const uint32x4_t C1 = MULT_FIX(B1, fxy_scale_half);
|
||||
const uint32x4_t C0 = MULT_FIX_FLOOR(B0, fxy_scale_half);
|
||||
const uint32x4_t C1 = MULT_FIX_FLOOR(B1, fxy_scale_half);
|
||||
const uint16x4_t D0 = vmovn_u32(C0);
|
||||
const uint16x4_t D1 = vmovn_u32(C1);
|
||||
const uint8x8_t E = vmovn_u16(vcombine_u16(D0, D1));
|
||||
@@ -145,7 +149,7 @@ static void RescalerExportRowShrink_NEON(WebPRescaler* const wrk) {
|
||||
}
|
||||
for (; x_out < x_out_max; ++x_out) {
|
||||
const uint32_t frac = (uint32_t)MULT_FIX_C(frow[x_out], yscale);
|
||||
const int v = (int)MULT_FIX_C(irow[x_out] - frac, wrk->fxy_scale);
|
||||
const int v = (int)MULT_FIX_FLOOR_C(irow[x_out] - frac, fxy_scale);
|
||||
assert(v >= 0 && v <= 255);
|
||||
dst[x_out] = v;
|
||||
irow[x_out] = frac; // new fractional start
|
||||
@@ -170,6 +174,12 @@ static void RescalerExportRowShrink_NEON(WebPRescaler* const wrk) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef MULT_FIX_FLOOR_C
|
||||
#undef MULT_FIX_C
|
||||
#undef MULT_FIX_FLOOR
|
||||
#undef MULT_FIX
|
||||
#undef ROUNDER
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern void WebPRescalerDspInitNEON(void);
|
||||
|
||||
+33
-2
@@ -25,6 +25,7 @@
|
||||
|
||||
#define ROUNDER (WEBP_RESCALER_ONE >> 1)
|
||||
#define MULT_FIX(x, y) (((uint64_t)(x) * (y) + ROUNDER) >> WEBP_RESCALER_RFIX)
|
||||
#define MULT_FIX_FLOOR(x, y) (((uint64_t)(x) * (y)) >> WEBP_RESCALER_RFIX)
|
||||
|
||||
// input: 8 bytes ABCDEFGH -> output: A0E0B0F0C0G0D0H0
|
||||
static void LoadTwoPixels_SSE2(const uint8_t* const src, __m128i* out) {
|
||||
@@ -224,6 +225,35 @@ static WEBP_INLINE void ProcessRow_SSE2(const __m128i* const A0,
|
||||
_mm_storel_epi64((__m128i*)dst, G);
|
||||
}
|
||||
|
||||
static WEBP_INLINE void ProcessRow_Floor_SSE2(const __m128i* const A0,
|
||||
const __m128i* const A1,
|
||||
const __m128i* const A2,
|
||||
const __m128i* const A3,
|
||||
const __m128i* const mult,
|
||||
uint8_t* const dst) {
|
||||
const __m128i mask = _mm_set_epi32(0xffffffffu, 0, 0xffffffffu, 0);
|
||||
const __m128i B0 = _mm_mul_epu32(*A0, *mult);
|
||||
const __m128i B1 = _mm_mul_epu32(*A1, *mult);
|
||||
const __m128i B2 = _mm_mul_epu32(*A2, *mult);
|
||||
const __m128i B3 = _mm_mul_epu32(*A3, *mult);
|
||||
const __m128i D0 = _mm_srli_epi64(B0, WEBP_RESCALER_RFIX);
|
||||
const __m128i D1 = _mm_srli_epi64(B1, WEBP_RESCALER_RFIX);
|
||||
#if (WEBP_RESCALER_RFIX < 32)
|
||||
const __m128i D2 =
|
||||
_mm_and_si128(_mm_slli_epi64(B2, 32 - WEBP_RESCALER_RFIX), mask);
|
||||
const __m128i D3 =
|
||||
_mm_and_si128(_mm_slli_epi64(B3, 32 - WEBP_RESCALER_RFIX), mask);
|
||||
#else
|
||||
const __m128i D2 = _mm_and_si128(B2, mask);
|
||||
const __m128i D3 = _mm_and_si128(B3, mask);
|
||||
#endif
|
||||
const __m128i E0 = _mm_or_si128(D0, D2);
|
||||
const __m128i E1 = _mm_or_si128(D1, D3);
|
||||
const __m128i F = _mm_packs_epi32(E0, E1);
|
||||
const __m128i G = _mm_packus_epi16(F, F);
|
||||
_mm_storel_epi64((__m128i*)dst, G);
|
||||
}
|
||||
|
||||
static void RescalerExportRowExpand_SSE2(WebPRescaler* const wrk) {
|
||||
int x_out;
|
||||
uint8_t* const dst = wrk->dst;
|
||||
@@ -322,12 +352,12 @@ static void RescalerExportRowShrink_SSE2(WebPRescaler* const wrk) {
|
||||
const __m128i G1 = _mm_or_si128(D1, F3);
|
||||
_mm_storeu_si128((__m128i*)(irow + x_out + 0), G0);
|
||||
_mm_storeu_si128((__m128i*)(irow + x_out + 4), G1);
|
||||
ProcessRow_SSE2(&E0, &E1, &E2, &E3, &mult_xy, dst + x_out);
|
||||
ProcessRow_Floor_SSE2(&E0, &E1, &E2, &E3, &mult_xy, dst + x_out);
|
||||
}
|
||||
}
|
||||
for (; x_out < x_out_max; ++x_out) {
|
||||
const uint32_t frac = (int)MULT_FIX(frow[x_out], yscale);
|
||||
const int v = (int)MULT_FIX(irow[x_out] - frac, wrk->fxy_scale);
|
||||
const int v = (int)MULT_FIX_FLOOR(irow[x_out] - frac, wrk->fxy_scale);
|
||||
assert(v >= 0 && v <= 255);
|
||||
dst[x_out] = v;
|
||||
irow[x_out] = frac; // new fractional start
|
||||
@@ -352,6 +382,7 @@ static void RescalerExportRowShrink_SSE2(WebPRescaler* const wrk) {
|
||||
}
|
||||
}
|
||||
|
||||
#undef MULT_FIX_FLOOR
|
||||
#undef MULT_FIX
|
||||
#undef ROUNDER
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -207,4 +207,4 @@ static WEBP_INLINE int VP8RGBToV(int r, int g, int b, int rounding) {
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_DSP_YUV_H_ */
|
||||
#endif // WEBP_DSP_YUV_H_
|
||||
|
||||
+1
-1
@@ -458,7 +458,7 @@ static void MergeJobs(const SegmentJob* const src, SegmentJob* const dst) {
|
||||
dst->uv_alpha += src->uv_alpha;
|
||||
}
|
||||
|
||||
// initialize the job struct with some TODOs
|
||||
// initialize the job struct with some tasks to perform
|
||||
static void InitSegmentJob(VP8Encoder* const enc, SegmentJob* const job,
|
||||
int start_row, int end_row) {
|
||||
WebPGetWorkerInterface()->Init(&job->worker);
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ static int CostModelBuild(CostModel* const m, int xsize, int cache_bits,
|
||||
|
||||
// The following code is similar to VP8LHistogramCreate but converts the
|
||||
// distance to plane code.
|
||||
VP8LHistogramInit(histo, cache_bits);
|
||||
VP8LHistogramInit(histo, cache_bits, /*init_arrays=*/ 1);
|
||||
while (VP8LRefsCursorOk(&c)) {
|
||||
VP8LHistogramAddSinglePixOrCopy(histo, c.cur_pos, VP8LDistanceToPlaneCode,
|
||||
xsize);
|
||||
|
||||
@@ -715,6 +715,7 @@ static int CalculateBestCacheSize(const uint32_t* argb, int quality,
|
||||
for (i = 0; i <= cache_bits_max; ++i) {
|
||||
histos[i] = VP8LAllocateHistogram(i);
|
||||
if (histos[i] == NULL) goto Error;
|
||||
VP8LHistogramInit(histos[i], i, /*init_arrays=*/ 1);
|
||||
if (i == 0) continue;
|
||||
cc_init[i] = VP8LColorCacheInit(&hashers[i], i);
|
||||
if (!cc_init[i]) goto Error;
|
||||
|
||||
Vendored
+1
-1
@@ -79,4 +79,4 @@ extern const uint16_t VP8FixedCostsI4[NUM_BMODES][NUM_BMODES][NUM_BMODES];
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* WEBP_ENC_COST_ENC_H_ */
|
||||
#endif // WEBP_ENC_COST_ENC_H_
|
||||
|
||||
+383
-171
@@ -51,10 +51,12 @@ static void HistogramCopy(const VP8LHistogram* const src,
|
||||
VP8LHistogram* const dst) {
|
||||
uint32_t* const dst_literal = dst->literal_;
|
||||
const int dst_cache_bits = dst->palette_code_bits_;
|
||||
const int literal_size = VP8LHistogramNumCodes(dst_cache_bits);
|
||||
const int histo_size = VP8LGetHistogramSize(dst_cache_bits);
|
||||
assert(src->palette_code_bits_ == dst_cache_bits);
|
||||
memcpy(dst, src, histo_size);
|
||||
dst->literal_ = dst_literal;
|
||||
memcpy(dst->literal_, src->literal_, literal_size * sizeof(*dst->literal_));
|
||||
}
|
||||
|
||||
int VP8LGetHistogramSize(int cache_bits) {
|
||||
@@ -91,9 +93,19 @@ void VP8LHistogramCreate(VP8LHistogram* const p,
|
||||
VP8LHistogramStoreRefs(refs, p);
|
||||
}
|
||||
|
||||
void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits) {
|
||||
void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits,
|
||||
int init_arrays) {
|
||||
p->palette_code_bits_ = palette_code_bits;
|
||||
HistogramClear(p);
|
||||
if (init_arrays) {
|
||||
HistogramClear(p);
|
||||
} else {
|
||||
p->trivial_symbol_ = 0;
|
||||
p->bit_cost_ = 0.;
|
||||
p->literal_cost_ = 0.;
|
||||
p->red_cost_ = 0.;
|
||||
p->blue_cost_ = 0.;
|
||||
memset(p->is_used_, 0, sizeof(p->is_used_));
|
||||
}
|
||||
}
|
||||
|
||||
VP8LHistogram* VP8LAllocateHistogram(int cache_bits) {
|
||||
@@ -104,37 +116,84 @@ VP8LHistogram* VP8LAllocateHistogram(int cache_bits) {
|
||||
histo = (VP8LHistogram*)memory;
|
||||
// literal_ won't necessary be aligned.
|
||||
histo->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram));
|
||||
VP8LHistogramInit(histo, cache_bits);
|
||||
VP8LHistogramInit(histo, cache_bits, /*init_arrays=*/ 0);
|
||||
return histo;
|
||||
}
|
||||
|
||||
// Resets the pointers of the histograms to point to the bit buffer in the set.
|
||||
static void HistogramSetResetPointers(VP8LHistogramSet* const set,
|
||||
int cache_bits) {
|
||||
int i;
|
||||
const int histo_size = VP8LGetHistogramSize(cache_bits);
|
||||
uint8_t* memory = (uint8_t*) (set->histograms);
|
||||
memory += set->max_size * sizeof(*set->histograms);
|
||||
for (i = 0; i < set->max_size; ++i) {
|
||||
memory = (uint8_t*) WEBP_ALIGN(memory);
|
||||
set->histograms[i] = (VP8LHistogram*) memory;
|
||||
// literal_ won't necessary be aligned.
|
||||
set->histograms[i]->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram));
|
||||
memory += histo_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the total size of the VP8LHistogramSet.
|
||||
static size_t HistogramSetTotalSize(int size, int cache_bits) {
|
||||
const int histo_size = VP8LGetHistogramSize(cache_bits);
|
||||
return (sizeof(VP8LHistogramSet) + size * (sizeof(VP8LHistogram*) +
|
||||
histo_size + WEBP_ALIGN_CST));
|
||||
}
|
||||
|
||||
VP8LHistogramSet* VP8LAllocateHistogramSet(int size, int cache_bits) {
|
||||
int i;
|
||||
VP8LHistogramSet* set;
|
||||
const int histo_size = VP8LGetHistogramSize(cache_bits);
|
||||
const size_t total_size =
|
||||
sizeof(*set) + size * (sizeof(*set->histograms) +
|
||||
histo_size + WEBP_ALIGN_CST);
|
||||
const size_t total_size = HistogramSetTotalSize(size, cache_bits);
|
||||
uint8_t* memory = (uint8_t*)WebPSafeMalloc(total_size, sizeof(*memory));
|
||||
if (memory == NULL) return NULL;
|
||||
|
||||
set = (VP8LHistogramSet*)memory;
|
||||
memory += sizeof(*set);
|
||||
set->histograms = (VP8LHistogram**)memory;
|
||||
memory += size * sizeof(*set->histograms);
|
||||
set->max_size = size;
|
||||
set->size = size;
|
||||
HistogramSetResetPointers(set, cache_bits);
|
||||
for (i = 0; i < size; ++i) {
|
||||
memory = (uint8_t*)WEBP_ALIGN(memory);
|
||||
set->histograms[i] = (VP8LHistogram*)memory;
|
||||
// literal_ won't necessary be aligned.
|
||||
set->histograms[i]->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram));
|
||||
VP8LHistogramInit(set->histograms[i], cache_bits);
|
||||
memory += histo_size;
|
||||
VP8LHistogramInit(set->histograms[i], cache_bits, /*init_arrays=*/ 0);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
void VP8LHistogramSetClear(VP8LHistogramSet* const set) {
|
||||
int i;
|
||||
const int cache_bits = set->histograms[0]->palette_code_bits_;
|
||||
const int size = set->max_size;
|
||||
const size_t total_size = HistogramSetTotalSize(size, cache_bits);
|
||||
uint8_t* memory = (uint8_t*)set;
|
||||
|
||||
memset(memory, 0, total_size);
|
||||
memory += sizeof(*set);
|
||||
set->histograms = (VP8LHistogram**)memory;
|
||||
set->max_size = size;
|
||||
set->size = size;
|
||||
HistogramSetResetPointers(set, cache_bits);
|
||||
for (i = 0; i < size; ++i) {
|
||||
set->histograms[i]->palette_code_bits_ = cache_bits;
|
||||
}
|
||||
}
|
||||
|
||||
// Removes the histogram 'i' from 'set' by setting it to NULL.
|
||||
static void HistogramSetRemoveHistogram(VP8LHistogramSet* const set, int i,
|
||||
int* const num_used) {
|
||||
assert(set->histograms[i] != NULL);
|
||||
set->histograms[i] = NULL;
|
||||
--*num_used;
|
||||
// If we remove the last valid one, shrink until the next valid one.
|
||||
if (i == set->size - 1) {
|
||||
while (set->size >= 1 && set->histograms[set->size - 1] == NULL) {
|
||||
--set->size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void VP8LHistogramAddSinglePixOrCopy(VP8LHistogram* const histo,
|
||||
@@ -237,7 +296,8 @@ static double FinalHuffmanCost(const VP8LStreaks* const stats) {
|
||||
// Get the symbol entropy for the distribution 'population'.
|
||||
// Set 'trivial_sym', if there's only one symbol present in the distribution.
|
||||
static double PopulationCost(const uint32_t* const population, int length,
|
||||
uint32_t* const trivial_sym) {
|
||||
uint32_t* const trivial_sym,
|
||||
uint8_t* const is_used) {
|
||||
VP8LBitEntropy bit_entropy;
|
||||
VP8LStreaks stats;
|
||||
VP8LGetEntropyUnrefined(population, length, &bit_entropy, &stats);
|
||||
@@ -245,6 +305,8 @@ static double PopulationCost(const uint32_t* const population, int length,
|
||||
*trivial_sym = (bit_entropy.nonzeros == 1) ? bit_entropy.nonzero_code
|
||||
: VP8L_NON_TRIVIAL_SYM;
|
||||
}
|
||||
// The histogram is used if there is at least one non-zero streak.
|
||||
*is_used = (stats.streaks[1][0] != 0 || stats.streaks[1][1] != 0);
|
||||
|
||||
return BitsEntropyRefine(&bit_entropy) + FinalHuffmanCost(&stats);
|
||||
}
|
||||
@@ -253,7 +315,9 @@ static double PopulationCost(const uint32_t* const population, int length,
|
||||
// non-zero: both the zero-th one, or both the last one.
|
||||
static WEBP_INLINE double GetCombinedEntropy(const uint32_t* const X,
|
||||
const uint32_t* const Y,
|
||||
int length, int trivial_at_end) {
|
||||
int length, int is_X_used,
|
||||
int is_Y_used,
|
||||
int trivial_at_end) {
|
||||
VP8LStreaks stats;
|
||||
if (trivial_at_end) {
|
||||
// This configuration is due to palettization that transforms an indexed
|
||||
@@ -262,28 +326,43 @@ static WEBP_INLINE double GetCombinedEntropy(const uint32_t* const X,
|
||||
// Only FinalHuffmanCost needs to be evaluated.
|
||||
memset(&stats, 0, sizeof(stats));
|
||||
// Deal with the non-zero value at index 0 or length-1.
|
||||
stats.streaks[1][0] += 1;
|
||||
stats.streaks[1][0] = 1;
|
||||
// Deal with the following/previous zero streak.
|
||||
stats.counts[0] += 1;
|
||||
stats.streaks[0][1] += length - 1;
|
||||
stats.counts[0] = 1;
|
||||
stats.streaks[0][1] = length - 1;
|
||||
return FinalHuffmanCost(&stats);
|
||||
} else {
|
||||
VP8LBitEntropy bit_entropy;
|
||||
VP8LGetCombinedEntropyUnrefined(X, Y, length, &bit_entropy, &stats);
|
||||
if (is_X_used) {
|
||||
if (is_Y_used) {
|
||||
VP8LGetCombinedEntropyUnrefined(X, Y, length, &bit_entropy, &stats);
|
||||
} else {
|
||||
VP8LGetEntropyUnrefined(X, length, &bit_entropy, &stats);
|
||||
}
|
||||
} else {
|
||||
if (is_Y_used) {
|
||||
VP8LGetEntropyUnrefined(Y, length, &bit_entropy, &stats);
|
||||
} else {
|
||||
memset(&stats, 0, sizeof(stats));
|
||||
stats.counts[0] = 1;
|
||||
stats.streaks[0][length > 3] = length;
|
||||
VP8LBitEntropyInit(&bit_entropy);
|
||||
}
|
||||
}
|
||||
|
||||
return BitsEntropyRefine(&bit_entropy) + FinalHuffmanCost(&stats);
|
||||
}
|
||||
}
|
||||
|
||||
// Estimates the Entropy + Huffman + other block overhead size cost.
|
||||
double VP8LHistogramEstimateBits(const VP8LHistogram* const p) {
|
||||
double VP8LHistogramEstimateBits(VP8LHistogram* const p) {
|
||||
return
|
||||
PopulationCost(
|
||||
p->literal_, VP8LHistogramNumCodes(p->palette_code_bits_), NULL)
|
||||
+ PopulationCost(p->red_, NUM_LITERAL_CODES, NULL)
|
||||
+ PopulationCost(p->blue_, NUM_LITERAL_CODES, NULL)
|
||||
+ PopulationCost(p->alpha_, NUM_LITERAL_CODES, NULL)
|
||||
+ PopulationCost(p->distance_, NUM_DISTANCE_CODES, NULL)
|
||||
PopulationCost(p->literal_, VP8LHistogramNumCodes(p->palette_code_bits_),
|
||||
NULL, &p->is_used_[0])
|
||||
+ PopulationCost(p->red_, NUM_LITERAL_CODES, NULL, &p->is_used_[1])
|
||||
+ PopulationCost(p->blue_, NUM_LITERAL_CODES, NULL, &p->is_used_[2])
|
||||
+ PopulationCost(p->alpha_, NUM_LITERAL_CODES, NULL, &p->is_used_[3])
|
||||
+ PopulationCost(p->distance_, NUM_DISTANCE_CODES, NULL, &p->is_used_[4])
|
||||
+ VP8LExtraCost(p->literal_ + NUM_LITERAL_CODES, NUM_LENGTH_CODES)
|
||||
+ VP8LExtraCost(p->distance_, NUM_DISTANCE_CODES);
|
||||
}
|
||||
@@ -299,7 +378,8 @@ static int GetCombinedHistogramEntropy(const VP8LHistogram* const a,
|
||||
int trivial_at_end = 0;
|
||||
assert(a->palette_code_bits_ == b->palette_code_bits_);
|
||||
*cost += GetCombinedEntropy(a->literal_, b->literal_,
|
||||
VP8LHistogramNumCodes(palette_code_bits), 0);
|
||||
VP8LHistogramNumCodes(palette_code_bits),
|
||||
a->is_used_[0], b->is_used_[0], 0);
|
||||
*cost += VP8LExtraCostCombined(a->literal_ + NUM_LITERAL_CODES,
|
||||
b->literal_ + NUM_LITERAL_CODES,
|
||||
NUM_LENGTH_CODES);
|
||||
@@ -319,19 +399,23 @@ static int GetCombinedHistogramEntropy(const VP8LHistogram* const a,
|
||||
}
|
||||
|
||||
*cost +=
|
||||
GetCombinedEntropy(a->red_, b->red_, NUM_LITERAL_CODES, trivial_at_end);
|
||||
GetCombinedEntropy(a->red_, b->red_, NUM_LITERAL_CODES, a->is_used_[1],
|
||||
b->is_used_[1], trivial_at_end);
|
||||
if (*cost > cost_threshold) return 0;
|
||||
|
||||
*cost +=
|
||||
GetCombinedEntropy(a->blue_, b->blue_, NUM_LITERAL_CODES, trivial_at_end);
|
||||
if (*cost > cost_threshold) return 0;
|
||||
|
||||
*cost += GetCombinedEntropy(a->alpha_, b->alpha_, NUM_LITERAL_CODES,
|
||||
trivial_at_end);
|
||||
GetCombinedEntropy(a->blue_, b->blue_, NUM_LITERAL_CODES, a->is_used_[2],
|
||||
b->is_used_[2], trivial_at_end);
|
||||
if (*cost > cost_threshold) return 0;
|
||||
|
||||
*cost +=
|
||||
GetCombinedEntropy(a->distance_, b->distance_, NUM_DISTANCE_CODES, 0);
|
||||
GetCombinedEntropy(a->alpha_, b->alpha_, NUM_LITERAL_CODES,
|
||||
a->is_used_[3], b->is_used_[3], trivial_at_end);
|
||||
if (*cost > cost_threshold) return 0;
|
||||
|
||||
*cost +=
|
||||
GetCombinedEntropy(a->distance_, b->distance_, NUM_DISTANCE_CODES,
|
||||
a->is_used_[4], b->is_used_[4], 0);
|
||||
*cost +=
|
||||
VP8LExtraCostCombined(a->distance_, b->distance_, NUM_DISTANCE_CODES);
|
||||
if (*cost > cost_threshold) return 0;
|
||||
@@ -377,7 +461,9 @@ static double HistogramAddEval(const VP8LHistogram* const a,
|
||||
static double HistogramAddThresh(const VP8LHistogram* const a,
|
||||
const VP8LHistogram* const b,
|
||||
double cost_threshold) {
|
||||
double cost = -a->bit_cost_;
|
||||
double cost;
|
||||
assert(a != NULL && b != NULL);
|
||||
cost = -a->bit_cost_;
|
||||
GetCombinedHistogramEntropy(a, b, cost_threshold, &cost);
|
||||
return cost;
|
||||
}
|
||||
@@ -419,16 +505,19 @@ static void UpdateDominantCostRange(
|
||||
static void UpdateHistogramCost(VP8LHistogram* const h) {
|
||||
uint32_t alpha_sym, red_sym, blue_sym;
|
||||
const double alpha_cost =
|
||||
PopulationCost(h->alpha_, NUM_LITERAL_CODES, &alpha_sym);
|
||||
PopulationCost(h->alpha_, NUM_LITERAL_CODES, &alpha_sym,
|
||||
&h->is_used_[3]);
|
||||
const double distance_cost =
|
||||
PopulationCost(h->distance_, NUM_DISTANCE_CODES, NULL) +
|
||||
PopulationCost(h->distance_, NUM_DISTANCE_CODES, NULL, &h->is_used_[4]) +
|
||||
VP8LExtraCost(h->distance_, NUM_DISTANCE_CODES);
|
||||
const int num_codes = VP8LHistogramNumCodes(h->palette_code_bits_);
|
||||
h->literal_cost_ = PopulationCost(h->literal_, num_codes, NULL) +
|
||||
VP8LExtraCost(h->literal_ + NUM_LITERAL_CODES,
|
||||
NUM_LENGTH_CODES);
|
||||
h->red_cost_ = PopulationCost(h->red_, NUM_LITERAL_CODES, &red_sym);
|
||||
h->blue_cost_ = PopulationCost(h->blue_, NUM_LITERAL_CODES, &blue_sym);
|
||||
h->literal_cost_ =
|
||||
PopulationCost(h->literal_, num_codes, NULL, &h->is_used_[0]) +
|
||||
VP8LExtraCost(h->literal_ + NUM_LITERAL_CODES, NUM_LENGTH_CODES);
|
||||
h->red_cost_ =
|
||||
PopulationCost(h->red_, NUM_LITERAL_CODES, &red_sym, &h->is_used_[1]);
|
||||
h->blue_cost_ =
|
||||
PopulationCost(h->blue_, NUM_LITERAL_CODES, &blue_sym, &h->is_used_[2]);
|
||||
h->bit_cost_ = h->literal_cost_ + h->red_cost_ + h->blue_cost_ +
|
||||
alpha_cost + distance_cost;
|
||||
if ((alpha_sym | red_sym | blue_sym) == VP8L_NON_TRIVIAL_SYM) {
|
||||
@@ -473,6 +562,7 @@ static void HistogramBuild(
|
||||
VP8LHistogram** const histograms = image_histo->histograms;
|
||||
VP8LRefsCursor c = VP8LRefsCursorInit(backward_refs);
|
||||
assert(histo_bits > 0);
|
||||
VP8LHistogramSetClear(image_histo);
|
||||
while (VP8LRefsCursorOk(&c)) {
|
||||
const PixOrCopy* const v = c.cur_pos;
|
||||
const int ix = (y >> histo_bits) * histo_xsize + (x >> histo_bits);
|
||||
@@ -487,17 +577,37 @@ static void HistogramBuild(
|
||||
}
|
||||
|
||||
// Copies the histograms and computes its bit_cost.
|
||||
static void HistogramCopyAndAnalyze(
|
||||
VP8LHistogramSet* const orig_histo, VP8LHistogramSet* const image_histo) {
|
||||
int i;
|
||||
const int histo_size = orig_histo->size;
|
||||
static const uint16_t kInvalidHistogramSymbol = (uint16_t)(-1);
|
||||
static void HistogramCopyAndAnalyze(VP8LHistogramSet* const orig_histo,
|
||||
VP8LHistogramSet* const image_histo,
|
||||
int* const num_used,
|
||||
uint16_t* const histogram_symbols) {
|
||||
int i, cluster_id;
|
||||
int num_used_orig = *num_used;
|
||||
VP8LHistogram** const orig_histograms = orig_histo->histograms;
|
||||
VP8LHistogram** const histograms = image_histo->histograms;
|
||||
for (i = 0; i < histo_size; ++i) {
|
||||
assert(image_histo->max_size == orig_histo->max_size);
|
||||
for (cluster_id = 0, i = 0; i < orig_histo->max_size; ++i) {
|
||||
VP8LHistogram* const histo = orig_histograms[i];
|
||||
UpdateHistogramCost(histo);
|
||||
// Copy histograms from orig_histo[] to image_histo[].
|
||||
HistogramCopy(histo, histograms[i]);
|
||||
|
||||
// Skip the histogram if it is completely empty, which can happen for tiles
|
||||
// with no information (when they are skipped because of LZ77).
|
||||
if (!histo->is_used_[0] && !histo->is_used_[1] && !histo->is_used_[2]
|
||||
&& !histo->is_used_[3] && !histo->is_used_[4]) {
|
||||
// The first histogram is always used. If an histogram is empty, we set
|
||||
// its id to be the same as the previous one: this will improve
|
||||
// compressibility for later LZ77.
|
||||
assert(i > 0);
|
||||
HistogramSetRemoveHistogram(image_histo, i, num_used);
|
||||
HistogramSetRemoveHistogram(orig_histo, i, &num_used_orig);
|
||||
histogram_symbols[i] = kInvalidHistogramSymbol;
|
||||
} else {
|
||||
// Copy histograms from orig_histo[] to image_histo[].
|
||||
HistogramCopy(histo, histograms[i]);
|
||||
histogram_symbols[i] = cluster_id++;
|
||||
assert(cluster_id <= image_histo->max_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,29 +624,33 @@ static void HistogramAnalyzeEntropyBin(VP8LHistogramSet* const image_histo,
|
||||
|
||||
// Analyze the dominant (literal, red and blue) entropy costs.
|
||||
for (i = 0; i < histo_size; ++i) {
|
||||
if (histograms[i] == NULL) continue;
|
||||
UpdateDominantCostRange(histograms[i], &cost_range);
|
||||
}
|
||||
|
||||
// bin-hash histograms on three of the dominant (literal, red and blue)
|
||||
// symbol costs and store the resulting bin_id for each histogram.
|
||||
for (i = 0; i < histo_size; ++i) {
|
||||
// bin_map[i] is not set to a special value as its use will later be guarded
|
||||
// by another (histograms[i] == NULL).
|
||||
if (histograms[i] == NULL) continue;
|
||||
bin_map[i] = GetHistoBinIndex(histograms[i], &cost_range, low_effort);
|
||||
}
|
||||
}
|
||||
|
||||
// Compact image_histo[] by merging some histograms with same bin_id together if
|
||||
// it's advantageous.
|
||||
// Merges some histograms with same bin_id together if it's advantageous.
|
||||
// Sets the remaining histograms to NULL.
|
||||
static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo,
|
||||
int *num_used,
|
||||
const uint16_t* const clusters,
|
||||
uint16_t* const cluster_mappings,
|
||||
VP8LHistogram* cur_combo,
|
||||
const uint16_t* const bin_map,
|
||||
int bin_map_size, int num_bins,
|
||||
int num_bins,
|
||||
double combine_cost_factor,
|
||||
int low_effort) {
|
||||
VP8LHistogram** const histograms = image_histo->histograms;
|
||||
int idx;
|
||||
// Work in-place: processed histograms are put at the beginning of
|
||||
// image_histo[]. At the end, we just have to truncate the array.
|
||||
int size = 0;
|
||||
struct {
|
||||
int16_t first; // position of the histogram that accumulates all
|
||||
// histograms with the same bin_id
|
||||
@@ -549,16 +663,19 @@ static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo,
|
||||
bin_info[idx].num_combine_failures = 0;
|
||||
}
|
||||
|
||||
for (idx = 0; idx < bin_map_size; ++idx) {
|
||||
const int bin_id = bin_map[idx];
|
||||
const int first = bin_info[bin_id].first;
|
||||
assert(size <= idx);
|
||||
// By default, a cluster matches itself.
|
||||
for (idx = 0; idx < *num_used; ++idx) cluster_mappings[idx] = idx;
|
||||
for (idx = 0; idx < image_histo->size; ++idx) {
|
||||
int bin_id, first;
|
||||
if (histograms[idx] == NULL) continue;
|
||||
bin_id = bin_map[idx];
|
||||
first = bin_info[bin_id].first;
|
||||
if (first == -1) {
|
||||
// just move histogram #idx to its final position
|
||||
histograms[size] = histograms[idx];
|
||||
bin_info[bin_id].first = size++;
|
||||
bin_info[bin_id].first = idx;
|
||||
} else if (low_effort) {
|
||||
HistogramAdd(histograms[idx], histograms[first], histograms[first]);
|
||||
HistogramSetRemoveHistogram(image_histo, idx, num_used);
|
||||
cluster_mappings[clusters[idx]] = clusters[first];
|
||||
} else {
|
||||
// try to merge #idx into #first (both share the same bin_id)
|
||||
const double bit_cost = histograms[idx]->bit_cost_;
|
||||
@@ -581,19 +698,18 @@ static void HistogramCombineEntropyBin(VP8LHistogramSet* const image_histo,
|
||||
bin_info[bin_id].num_combine_failures >= max_combine_failures) {
|
||||
// move the (better) merged histogram to its final slot
|
||||
HistogramSwap(&cur_combo, &histograms[first]);
|
||||
HistogramSetRemoveHistogram(image_histo, idx, num_used);
|
||||
cluster_mappings[clusters[idx]] = clusters[first];
|
||||
} else {
|
||||
histograms[size++] = histograms[idx];
|
||||
++bin_info[bin_id].num_combine_failures;
|
||||
}
|
||||
} else {
|
||||
histograms[size++] = histograms[idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
image_histo->size = size;
|
||||
if (low_effort) {
|
||||
// for low_effort case, update the final cost when everything is merged
|
||||
for (idx = 0; idx < size; ++idx) {
|
||||
for (idx = 0; idx < image_histo->size; ++idx) {
|
||||
if (histograms[idx] == NULL) continue;
|
||||
UpdateHistogramCost(histograms[idx]);
|
||||
}
|
||||
}
|
||||
@@ -624,16 +740,9 @@ typedef struct {
|
||||
int max_size;
|
||||
} HistoQueue;
|
||||
|
||||
static int HistoQueueInit(HistoQueue* const histo_queue, const int max_index) {
|
||||
static int HistoQueueInit(HistoQueue* const histo_queue, const int max_size) {
|
||||
histo_queue->size = 0;
|
||||
// max_index^2 for the queue size is safe. If you look at
|
||||
// HistogramCombineGreedy, and imagine that UpdateQueueFront always pushes
|
||||
// data to the queue, you insert at most:
|
||||
// - max_index*(max_index-1)/2 (the first two for loops)
|
||||
// - max_index - 1 in the last for loop at the first iteration of the while
|
||||
// loop, max_index - 2 at the second iteration ... therefore
|
||||
// max_index*(max_index-1)/2 overall too
|
||||
histo_queue->max_size = max_index * max_index;
|
||||
histo_queue->max_size = max_size;
|
||||
// We allocate max_size + 1 because the last element at index "size" is
|
||||
// used as temporary data (and it could be up to max_size).
|
||||
histo_queue->queue = (HistogramPair*)WebPSafeMalloc(
|
||||
@@ -674,6 +783,18 @@ static void HistoQueueUpdateHead(HistoQueue* const histo_queue,
|
||||
}
|
||||
}
|
||||
|
||||
// Update the cost diff and combo of a pair of histograms. This needs to be
|
||||
// called when the the histograms have been merged with a third one.
|
||||
static void HistoQueueUpdatePair(const VP8LHistogram* const h1,
|
||||
const VP8LHistogram* const h2,
|
||||
double threshold,
|
||||
HistogramPair* const pair) {
|
||||
const double sum_cost = h1->bit_cost_ + h2->bit_cost_;
|
||||
pair->cost_combo = 0.;
|
||||
GetCombinedHistogramEntropy(h1, h2, sum_cost + threshold, &pair->cost_combo);
|
||||
pair->cost_diff = pair->cost_combo - sum_cost;
|
||||
}
|
||||
|
||||
// Create a pair from indices "idx1" and "idx2" provided its cost
|
||||
// is inferior to "threshold", a negative entropy.
|
||||
// It returns the cost of the pair, or 0. if it superior to threshold.
|
||||
@@ -683,8 +804,9 @@ static double HistoQueuePush(HistoQueue* const histo_queue,
|
||||
const VP8LHistogram* h1;
|
||||
const VP8LHistogram* h2;
|
||||
HistogramPair pair;
|
||||
double sum_cost;
|
||||
|
||||
// Stop here if the queue is full.
|
||||
if (histo_queue->size == histo_queue->max_size) return 0.;
|
||||
assert(threshold <= 0.);
|
||||
if (idx1 > idx2) {
|
||||
const int tmp = idx2;
|
||||
@@ -695,16 +817,12 @@ static double HistoQueuePush(HistoQueue* const histo_queue,
|
||||
pair.idx2 = idx2;
|
||||
h1 = histograms[idx1];
|
||||
h2 = histograms[idx2];
|
||||
sum_cost = h1->bit_cost_ + h2->bit_cost_;
|
||||
pair.cost_combo = 0.;
|
||||
GetCombinedHistogramEntropy(h1, h2, sum_cost + threshold, &pair.cost_combo);
|
||||
pair.cost_diff = pair.cost_combo - sum_cost;
|
||||
|
||||
HistoQueueUpdatePair(h1, h2, threshold, &pair);
|
||||
|
||||
// Do not even consider the pair if it does not improve the entropy.
|
||||
if (pair.cost_diff >= threshold) return 0.;
|
||||
|
||||
// We cannot add more elements than the capacity.
|
||||
assert(histo_queue->size < histo_queue->max_size);
|
||||
histo_queue->queue[histo_queue->size++] = pair;
|
||||
HistoQueueUpdateHead(histo_queue, &histo_queue->queue[histo_queue->size - 1]);
|
||||
|
||||
@@ -715,42 +833,43 @@ static double HistoQueuePush(HistoQueue* const histo_queue,
|
||||
|
||||
// Combines histograms by continuously choosing the one with the highest cost
|
||||
// reduction.
|
||||
static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo) {
|
||||
static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo,
|
||||
int* const num_used) {
|
||||
int ok = 0;
|
||||
int image_histo_size = image_histo->size;
|
||||
const int image_histo_size = image_histo->size;
|
||||
int i, j;
|
||||
VP8LHistogram** const histograms = image_histo->histograms;
|
||||
// Indexes of remaining histograms.
|
||||
int* const clusters =
|
||||
(int*)WebPSafeMalloc(image_histo_size, sizeof(*clusters));
|
||||
// Priority queue of histogram pairs.
|
||||
HistoQueue histo_queue;
|
||||
|
||||
if (!HistoQueueInit(&histo_queue, image_histo_size) || clusters == NULL) {
|
||||
// image_histo_size^2 for the queue size is safe. If you look at
|
||||
// HistogramCombineGreedy, and imagine that UpdateQueueFront always pushes
|
||||
// data to the queue, you insert at most:
|
||||
// - image_histo_size*(image_histo_size-1)/2 (the first two for loops)
|
||||
// - image_histo_size - 1 in the last for loop at the first iteration of
|
||||
// the while loop, image_histo_size - 2 at the second iteration ...
|
||||
// therefore image_histo_size*(image_histo_size-1)/2 overall too
|
||||
if (!HistoQueueInit(&histo_queue, image_histo_size * image_histo_size)) {
|
||||
goto End;
|
||||
}
|
||||
|
||||
for (i = 0; i < image_histo_size; ++i) {
|
||||
// Initialize clusters indexes.
|
||||
clusters[i] = i;
|
||||
if (image_histo->histograms[i] == NULL) continue;
|
||||
for (j = i + 1; j < image_histo_size; ++j) {
|
||||
// Initialize positions array.
|
||||
// Initialize queue.
|
||||
if (image_histo->histograms[j] == NULL) continue;
|
||||
HistoQueuePush(&histo_queue, histograms, i, j, 0.);
|
||||
}
|
||||
}
|
||||
|
||||
while (image_histo_size > 1 && histo_queue.size > 0) {
|
||||
while (histo_queue.size > 0) {
|
||||
const int idx1 = histo_queue.queue[0].idx1;
|
||||
const int idx2 = histo_queue.queue[0].idx2;
|
||||
HistogramAdd(histograms[idx2], histograms[idx1], histograms[idx1]);
|
||||
histograms[idx1]->bit_cost_ = histo_queue.queue[0].cost_combo;
|
||||
|
||||
// Remove merged histogram.
|
||||
for (i = 0; i + 1 < image_histo_size; ++i) {
|
||||
if (clusters[i] >= idx2) {
|
||||
clusters[i] = clusters[i + 1];
|
||||
}
|
||||
}
|
||||
--image_histo_size;
|
||||
HistogramSetRemoveHistogram(image_histo, idx2, num_used);
|
||||
|
||||
// Remove pairs intersecting the just combined best pair.
|
||||
for (i = 0; i < histo_queue.size;) {
|
||||
@@ -765,24 +884,15 @@ static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo) {
|
||||
}
|
||||
|
||||
// Push new pairs formed with combined histogram to the queue.
|
||||
for (i = 0; i < image_histo_size; ++i) {
|
||||
if (clusters[i] != idx1) {
|
||||
HistoQueuePush(&histo_queue, histograms, idx1, clusters[i], 0.);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Move remaining histograms to the beginning of the array.
|
||||
for (i = 0; i < image_histo_size; ++i) {
|
||||
if (i != clusters[i]) { // swap the two histograms
|
||||
HistogramSwap(&histograms[i], &histograms[clusters[i]]);
|
||||
for (i = 0; i < image_histo->size; ++i) {
|
||||
if (i == idx1 || image_histo->histograms[i] == NULL) continue;
|
||||
HistoQueuePush(&histo_queue, image_histo->histograms, idx1, i, 0.);
|
||||
}
|
||||
}
|
||||
|
||||
image_histo->size = image_histo_size;
|
||||
ok = 1;
|
||||
|
||||
End:
|
||||
WebPSafeFree(clusters);
|
||||
HistoQueueClear(&histo_queue);
|
||||
return ok;
|
||||
}
|
||||
@@ -790,47 +900,69 @@ static int HistogramCombineGreedy(VP8LHistogramSet* const image_histo) {
|
||||
// Perform histogram aggregation using a stochastic approach.
|
||||
// 'do_greedy' is set to 1 if a greedy approach needs to be performed
|
||||
// afterwards, 0 otherwise.
|
||||
static int PairComparison(const void* idx1, const void* idx2) {
|
||||
// To be used with bsearch: <0 when *idx1<*idx2, >0 if >, 0 when ==.
|
||||
return (*(int*) idx1 - *(int*) idx2);
|
||||
}
|
||||
static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo,
|
||||
int min_cluster_size,
|
||||
int* const num_used, int min_cluster_size,
|
||||
int* const do_greedy) {
|
||||
int iter;
|
||||
int j, iter;
|
||||
uint32_t seed = 1;
|
||||
int tries_with_no_success = 0;
|
||||
int image_histo_size = image_histo->size;
|
||||
const int outer_iters = image_histo_size;
|
||||
const int outer_iters = *num_used;
|
||||
const int num_tries_no_success = outer_iters / 2;
|
||||
VP8LHistogram** const histograms = image_histo->histograms;
|
||||
// Priority queue of histogram pairs. Its size of "kCostHeapSizeSqrt"^2
|
||||
// Priority queue of histogram pairs. Its size of 'kHistoQueueSize'
|
||||
// impacts the quality of the compression and the speed: the smaller the
|
||||
// faster but the worse for the compression.
|
||||
HistoQueue histo_queue;
|
||||
const int kHistoQueueSizeSqrt = 3;
|
||||
const int kHistoQueueSize = 9;
|
||||
int ok = 0;
|
||||
// mapping from an index in image_histo with no NULL histogram to the full
|
||||
// blown image_histo.
|
||||
int* mappings;
|
||||
|
||||
if (!HistoQueueInit(&histo_queue, kHistoQueueSizeSqrt)) {
|
||||
if (*num_used < min_cluster_size) {
|
||||
*do_greedy = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mappings = (int*) WebPSafeMalloc(*num_used, sizeof(*mappings));
|
||||
if (mappings == NULL || !HistoQueueInit(&histo_queue, kHistoQueueSize)) {
|
||||
goto End;
|
||||
}
|
||||
// Fill the initial mapping.
|
||||
for (j = 0, iter = 0; iter < image_histo->size; ++iter) {
|
||||
if (histograms[iter] == NULL) continue;
|
||||
mappings[j++] = iter;
|
||||
}
|
||||
assert(j == *num_used);
|
||||
|
||||
// Collapse similar histograms in 'image_histo'.
|
||||
++min_cluster_size;
|
||||
for (iter = 0; iter < outer_iters && image_histo_size >= min_cluster_size &&
|
||||
++tries_with_no_success < num_tries_no_success;
|
||||
for (iter = 0;
|
||||
iter < outer_iters && *num_used >= min_cluster_size &&
|
||||
++tries_with_no_success < num_tries_no_success;
|
||||
++iter) {
|
||||
int* mapping_index;
|
||||
double best_cost =
|
||||
(histo_queue.size == 0) ? 0. : histo_queue.queue[0].cost_diff;
|
||||
int best_idx1 = -1, best_idx2 = 1;
|
||||
int j;
|
||||
const uint32_t rand_range = (image_histo_size - 1) * image_histo_size;
|
||||
// image_histo_size / 2 was chosen empirically. Less means faster but worse
|
||||
const uint32_t rand_range = (*num_used - 1) * (*num_used);
|
||||
// (*num_used) / 2 was chosen empirically. Less means faster but worse
|
||||
// compression.
|
||||
const int num_tries = image_histo_size / 2;
|
||||
const int num_tries = (*num_used) / 2;
|
||||
|
||||
for (j = 0; j < num_tries; ++j) {
|
||||
// Pick random samples.
|
||||
for (j = 0; *num_used >= 2 && j < num_tries; ++j) {
|
||||
double curr_cost;
|
||||
// Choose two different histograms at random and try to combine them.
|
||||
const uint32_t tmp = MyRand(&seed) % rand_range;
|
||||
const uint32_t idx1 = tmp / (image_histo_size - 1);
|
||||
uint32_t idx2 = tmp % (image_histo_size - 1);
|
||||
uint32_t idx1 = tmp / (*num_used - 1);
|
||||
uint32_t idx2 = tmp % (*num_used - 1);
|
||||
if (idx2 >= idx1) ++idx2;
|
||||
idx1 = mappings[idx1];
|
||||
idx2 = mappings[idx2];
|
||||
|
||||
// Calculate cost reduction on combination.
|
||||
curr_cost =
|
||||
@@ -843,18 +975,21 @@ static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo,
|
||||
}
|
||||
if (histo_queue.size == 0) continue;
|
||||
|
||||
// Merge the two best histograms.
|
||||
// Get the best histograms.
|
||||
best_idx1 = histo_queue.queue[0].idx1;
|
||||
best_idx2 = histo_queue.queue[0].idx2;
|
||||
assert(best_idx1 < best_idx2);
|
||||
HistogramAddEval(histograms[best_idx1], histograms[best_idx2],
|
||||
histograms[best_idx1], 0);
|
||||
// Swap the best_idx2 histogram with the last one (which is now unused).
|
||||
--image_histo_size;
|
||||
if (best_idx2 != image_histo_size) {
|
||||
HistogramSwap(&histograms[image_histo_size], &histograms[best_idx2]);
|
||||
}
|
||||
histograms[image_histo_size] = NULL;
|
||||
// Pop best_idx2 from mappings.
|
||||
mapping_index = (int*) bsearch(&best_idx2, mappings, *num_used,
|
||||
sizeof(best_idx2), &PairComparison);
|
||||
assert(mapping_index != NULL);
|
||||
memmove(mapping_index, mapping_index + 1, sizeof(*mapping_index) *
|
||||
((*num_used) - (mapping_index - mappings) - 1));
|
||||
// Merge the histograms and remove best_idx2 from the queue.
|
||||
HistogramAdd(histograms[best_idx2], histograms[best_idx1],
|
||||
histograms[best_idx1]);
|
||||
histograms[best_idx1]->bit_cost_ = histo_queue.queue[0].cost_combo;
|
||||
HistogramSetRemoveHistogram(image_histo, best_idx2, num_used);
|
||||
// Parse the queue and update each pair that deals with best_idx1,
|
||||
// best_idx2 or image_histo_size.
|
||||
for (j = 0; j < histo_queue.size;) {
|
||||
@@ -877,12 +1012,6 @@ static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo,
|
||||
p->idx2 = best_idx1;
|
||||
do_eval = 1;
|
||||
}
|
||||
if (p->idx2 == image_histo_size) {
|
||||
// No need to re-evaluate here as it does not involve a pair
|
||||
// containing best_idx1 or best_idx2.
|
||||
p->idx2 = best_idx2;
|
||||
}
|
||||
assert(p->idx2 < image_histo_size);
|
||||
// Make sure the index order is respected.
|
||||
if (p->idx1 > p->idx2) {
|
||||
const int tmp = p->idx2;
|
||||
@@ -891,8 +1020,7 @@ static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo,
|
||||
}
|
||||
if (do_eval) {
|
||||
// Re-evaluate the cost of an updated pair.
|
||||
GetCombinedHistogramEntropy(histograms[p->idx1], histograms[p->idx2], 0,
|
||||
&p->cost_diff);
|
||||
HistoQueueUpdatePair(histograms[p->idx1], histograms[p->idx2], 0., p);
|
||||
if (p->cost_diff >= 0.) {
|
||||
HistoQueuePopPair(&histo_queue, p);
|
||||
continue;
|
||||
@@ -901,15 +1029,14 @@ static int HistogramCombineStochastic(VP8LHistogramSet* const image_histo,
|
||||
HistoQueueUpdateHead(&histo_queue, p);
|
||||
++j;
|
||||
}
|
||||
|
||||
tries_with_no_success = 0;
|
||||
}
|
||||
image_histo->size = image_histo_size;
|
||||
*do_greedy = (image_histo->size <= min_cluster_size);
|
||||
*do_greedy = (*num_used <= min_cluster_size);
|
||||
ok = 1;
|
||||
|
||||
End:
|
||||
HistoQueueClear(&histo_queue);
|
||||
WebPSafeFree(mappings);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -917,23 +1044,29 @@ End:
|
||||
// Histogram refinement
|
||||
|
||||
// Find the best 'out' histogram for each of the 'in' histograms.
|
||||
// At call-time, 'out' contains the histograms of the clusters.
|
||||
// Note: we assume that out[]->bit_cost_ is already up-to-date.
|
||||
static void HistogramRemap(const VP8LHistogramSet* const in,
|
||||
const VP8LHistogramSet* const out,
|
||||
VP8LHistogramSet* const out,
|
||||
uint16_t* const symbols) {
|
||||
int i;
|
||||
VP8LHistogram** const in_histo = in->histograms;
|
||||
VP8LHistogram** const out_histo = out->histograms;
|
||||
const int in_size = in->size;
|
||||
const int in_size = out->max_size;
|
||||
const int out_size = out->size;
|
||||
if (out_size > 1) {
|
||||
for (i = 0; i < in_size; ++i) {
|
||||
int best_out = 0;
|
||||
double best_bits = MAX_COST;
|
||||
int k;
|
||||
if (in_histo[i] == NULL) {
|
||||
// Arbitrarily set to the previous value if unused to help future LZ77.
|
||||
symbols[i] = symbols[i - 1];
|
||||
continue;
|
||||
}
|
||||
for (k = 0; k < out_size; ++k) {
|
||||
const double cur_bits =
|
||||
HistogramAddThresh(out_histo[k], in_histo[i], best_bits);
|
||||
double cur_bits;
|
||||
cur_bits = HistogramAddThresh(out_histo[k], in_histo[i], best_bits);
|
||||
if (k == 0 || cur_bits < best_bits) {
|
||||
best_bits = cur_bits;
|
||||
best_out = k;
|
||||
@@ -949,12 +1082,13 @@ static void HistogramRemap(const VP8LHistogramSet* const in,
|
||||
}
|
||||
|
||||
// Recompute each out based on raw and symbols.
|
||||
for (i = 0; i < out_size; ++i) {
|
||||
HistogramClear(out_histo[i]);
|
||||
}
|
||||
VP8LHistogramSetClear(out);
|
||||
out->size = out_size;
|
||||
|
||||
for (i = 0; i < in_size; ++i) {
|
||||
const int idx = symbols[i];
|
||||
int idx;
|
||||
if (in_histo[i] == NULL) continue;
|
||||
idx = symbols[i];
|
||||
HistogramAdd(in_histo[i], out_histo[idx], out_histo[idx]);
|
||||
}
|
||||
}
|
||||
@@ -970,6 +1104,70 @@ static double GetCombineCostFactor(int histo_size, int quality) {
|
||||
return combine_cost_factor;
|
||||
}
|
||||
|
||||
// Given a HistogramSet 'set', the mapping of clusters 'cluster_mapping' and the
|
||||
// current assignment of the cells in 'symbols', merge the clusters and
|
||||
// assign the smallest possible clusters values.
|
||||
static void OptimizeHistogramSymbols(const VP8LHistogramSet* const set,
|
||||
uint16_t* const cluster_mappings,
|
||||
int num_clusters,
|
||||
uint16_t* const cluster_mappings_tmp,
|
||||
uint16_t* const symbols) {
|
||||
int i, cluster_max;
|
||||
int do_continue = 1;
|
||||
// First, assign the lowest cluster to each pixel.
|
||||
while (do_continue) {
|
||||
do_continue = 0;
|
||||
for (i = 0; i < num_clusters; ++i) {
|
||||
int k;
|
||||
k = cluster_mappings[i];
|
||||
while (k != cluster_mappings[k]) {
|
||||
cluster_mappings[k] = cluster_mappings[cluster_mappings[k]];
|
||||
k = cluster_mappings[k];
|
||||
}
|
||||
if (k != cluster_mappings[i]) {
|
||||
do_continue = 1;
|
||||
cluster_mappings[i] = k;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create a mapping from a cluster id to its minimal version.
|
||||
cluster_max = 0;
|
||||
memset(cluster_mappings_tmp, 0,
|
||||
set->max_size * sizeof(*cluster_mappings_tmp));
|
||||
assert(cluster_mappings[0] == 0);
|
||||
// Re-map the ids.
|
||||
for (i = 0; i < set->max_size; ++i) {
|
||||
int cluster;
|
||||
if (symbols[i] == kInvalidHistogramSymbol) continue;
|
||||
cluster = cluster_mappings[symbols[i]];
|
||||
assert(symbols[i] < num_clusters);
|
||||
if (cluster > 0 && cluster_mappings_tmp[cluster] == 0) {
|
||||
++cluster_max;
|
||||
cluster_mappings_tmp[cluster] = cluster_max;
|
||||
}
|
||||
symbols[i] = cluster_mappings_tmp[cluster];
|
||||
}
|
||||
|
||||
// Make sure all cluster values are used.
|
||||
cluster_max = 0;
|
||||
for (i = 0; i < set->max_size; ++i) {
|
||||
if (symbols[i] == kInvalidHistogramSymbol) continue;
|
||||
if (symbols[i] <= cluster_max) continue;
|
||||
++cluster_max;
|
||||
assert(symbols[i] == cluster_max);
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveEmptyHistograms(VP8LHistogramSet* const image_histo) {
|
||||
uint32_t size;
|
||||
int i;
|
||||
for (i = 0, size = 0; i < image_histo->size; ++i) {
|
||||
if (image_histo->histograms[i] == NULL) continue;
|
||||
image_histo->histograms[size++] = image_histo->histograms[i];
|
||||
}
|
||||
image_histo->size = size;
|
||||
}
|
||||
|
||||
int VP8LGetHistoImageSymbols(int xsize, int ysize,
|
||||
const VP8LBackwardRefs* const refs,
|
||||
int quality, int low_effort,
|
||||
@@ -987,28 +1185,37 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize,
|
||||
// histograms of small sizes (as bin_map will be very sparse) and
|
||||
// maximum quality q==100 (to preserve the compression gains at that level).
|
||||
const int entropy_combine_num_bins = low_effort ? NUM_PARTITIONS : BIN_SIZE;
|
||||
const int entropy_combine =
|
||||
(orig_histo->size > entropy_combine_num_bins * 2) && (quality < 100);
|
||||
|
||||
if (orig_histo == NULL) goto Error;
|
||||
int entropy_combine;
|
||||
uint16_t* const map_tmp =
|
||||
WebPSafeMalloc(2 * image_histo_raw_size, sizeof(map_tmp));
|
||||
uint16_t* const cluster_mappings = map_tmp + image_histo_raw_size;
|
||||
int num_used = image_histo_raw_size;
|
||||
if (orig_histo == NULL || map_tmp == NULL) goto Error;
|
||||
|
||||
// Construct the histograms from backward references.
|
||||
HistogramBuild(xsize, histo_bits, refs, orig_histo);
|
||||
// Copies the histograms and computes its bit_cost.
|
||||
HistogramCopyAndAnalyze(orig_histo, image_histo);
|
||||
// histogram_symbols is optimized
|
||||
HistogramCopyAndAnalyze(orig_histo, image_histo, &num_used,
|
||||
histogram_symbols);
|
||||
|
||||
entropy_combine =
|
||||
(num_used > entropy_combine_num_bins * 2) && (quality < 100);
|
||||
|
||||
if (entropy_combine) {
|
||||
const int bin_map_size = orig_histo->size;
|
||||
// Reuse histogram_symbols storage. By definition, it's guaranteed to be ok.
|
||||
uint16_t* const bin_map = histogram_symbols;
|
||||
uint16_t* const bin_map = map_tmp;
|
||||
const double combine_cost_factor =
|
||||
GetCombineCostFactor(image_histo_raw_size, quality);
|
||||
const uint32_t num_clusters = num_used;
|
||||
|
||||
HistogramAnalyzeEntropyBin(orig_histo, bin_map, low_effort);
|
||||
HistogramAnalyzeEntropyBin(image_histo, bin_map, low_effort);
|
||||
// Collapse histograms with similar entropy.
|
||||
HistogramCombineEntropyBin(image_histo, tmp_histo, bin_map, bin_map_size,
|
||||
HistogramCombineEntropyBin(image_histo, &num_used, histogram_symbols,
|
||||
cluster_mappings, tmp_histo, bin_map,
|
||||
entropy_combine_num_bins, combine_cost_factor,
|
||||
low_effort);
|
||||
OptimizeHistogramSymbols(image_histo, cluster_mappings, num_clusters,
|
||||
map_tmp, histogram_symbols);
|
||||
}
|
||||
|
||||
// Don't combine the histograms using stochastic and greedy heuristics for
|
||||
@@ -1018,21 +1225,26 @@ int VP8LGetHistoImageSymbols(int xsize, int ysize,
|
||||
// cubic ramp between 1 and MAX_HISTO_GREEDY:
|
||||
const int threshold_size = (int)(1 + (x * x * x) * (MAX_HISTO_GREEDY - 1));
|
||||
int do_greedy;
|
||||
if (!HistogramCombineStochastic(image_histo, threshold_size, &do_greedy)) {
|
||||
if (!HistogramCombineStochastic(image_histo, &num_used, threshold_size,
|
||||
&do_greedy)) {
|
||||
goto Error;
|
||||
}
|
||||
if (do_greedy && !HistogramCombineGreedy(image_histo)) {
|
||||
goto Error;
|
||||
if (do_greedy) {
|
||||
RemoveEmptyHistograms(image_histo);
|
||||
if (!HistogramCombineGreedy(image_histo, &num_used)) {
|
||||
goto Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(vrabaud): Optimize HistogramRemap for low-effort compression mode.
|
||||
// Find the optimal map from original histograms to the final ones.
|
||||
RemoveEmptyHistograms(image_histo);
|
||||
HistogramRemap(orig_histo, image_histo, histogram_symbols);
|
||||
|
||||
ok = 1;
|
||||
|
||||
Error:
|
||||
VP8LFreeHistogramSet(orig_histo);
|
||||
WebPSafeFree(map_tmp);
|
||||
return ok;
|
||||
}
|
||||
|
||||
+8
-2
@@ -44,6 +44,7 @@ typedef struct {
|
||||
double literal_cost_; // Cached values of dominant entropy costs:
|
||||
double red_cost_; // literal, red & blue.
|
||||
double blue_cost_;
|
||||
uint8_t is_used_[5]; // 5 for literal, red, blue, alpha, distance
|
||||
} VP8LHistogram;
|
||||
|
||||
// Collection of histograms with fixed capacity, allocated as one
|
||||
@@ -67,7 +68,9 @@ void VP8LHistogramCreate(VP8LHistogram* const p,
|
||||
int VP8LGetHistogramSize(int palette_code_bits);
|
||||
|
||||
// Set the palette_code_bits and reset the stats.
|
||||
void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits);
|
||||
// If init_arrays is true, the arrays are also filled with 0's.
|
||||
void VP8LHistogramInit(VP8LHistogram* const p, int palette_code_bits,
|
||||
int init_arrays);
|
||||
|
||||
// Collect all the references into a histogram (without reset)
|
||||
void VP8LHistogramStoreRefs(const VP8LBackwardRefs* const refs,
|
||||
@@ -83,6 +86,9 @@ void VP8LFreeHistogramSet(VP8LHistogramSet* const histo);
|
||||
// using 'cache_bits'. Return NULL in case of memory error.
|
||||
VP8LHistogramSet* VP8LAllocateHistogramSet(int size, int cache_bits);
|
||||
|
||||
// Set the histograms in set to 0.
|
||||
void VP8LHistogramSetClear(VP8LHistogramSet* const set);
|
||||
|
||||
// Allocate and initialize histogram object with specified 'cache_bits'.
|
||||
// Returns NULL in case of memory error.
|
||||
// Special case of VP8LAllocateHistogramSet, with size equals 1.
|
||||
@@ -113,7 +119,7 @@ double VP8LBitsEntropy(const uint32_t* const array, int n);
|
||||
|
||||
// Estimate how many bits the combined entropy of literals and distance
|
||||
// approximately maps to.
|
||||
double VP8LHistogramEstimateBits(const VP8LHistogram* const p);
|
||||
double VP8LHistogramEstimateBits(VP8LHistogram* const p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user