33Pillow-SIMD is "following" Pillow fork (which is PIL fork itself).
44
55For more information about original Pillow, please
6- [ read the documentation] ( http://pillow.readthedocs.io/ ) ,
7- [ check the changelog] ( https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst ) and
8- [ find out how to contribute] ( https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md ) .
6+ [ read the documentation] [ original-docs ] ,
7+ [ check the changelog] [ original-changelog ] and
8+ [ find out how to contribute] [ original-contribute ] .
99
1010
11- ## What is SIMD
11+ ## Why SIMD
12+
13+ There are many ways to improve performance of image processing.
14+ You can use better algorithms for the same task, you can make better
15+ implementation for current algorithms, or you can use more processing unit
16+ resources. It is perfect, when you can just use more efficient algirithm like
17+ when gaussian blur based on convolutions [ was replaced] [ gaussian-blur-changes ]
18+ with sequential box filters. But the number of such improvements is very limited.
19+ It is also very tempting to use more processor unit resources
20+ (via parallelization), when they are available. But it is more handy just
21+ to make things faster on the same resources. And that is where SIMD works better.
22+
23+ SIMD stands for "single instruction, multiple data". This is a way to perform
24+ same operations against the huge amount of homogeneous data.
25+ Modern CPU have differnt SIMD instructions sets, like
26+ MMX, SSE-SSE4, AVX, AVX2, AVX512, NEON.
27+
28+ Currently, Pillow-SIMD can be [ compiled] ( #installation ) with SSE4 (default)
29+ and AVX2 support.
1230
1331
1432## Status
1533
34+ Pillow-SIMD can be used in production. Pillow-SIMD operates on
35+ [ Uploadcare] ( https://uploadcare.com/ ) serverse for more than 1 year.
36+ Uploadcare is SAAS for image storing and processing in the cloud
37+ and the main sponsor of Pillow-SIMD project.
38+
39+ Cuurently, following methods are accelerated:
40+
41+ - Resize (convolustion-based resample): SSE4, AVX2
42+ - Gaussian and box blur: SSE4
43+
1644
1745## Benchmarks
1846
19- Numbers are megapixels of source image per second. For example if resize of
20- 7712x4352 image is done in 0.5 seconds, the resoult will be 61.7 Mpx/s.
47+ The numbers are processed megapixels of source image per second.
48+ For example if resize of 7712x4352 image is done in 0.5 seconds,
49+ the result will be 61.7 Mpx/s.
2150
2251- ImageMagick 6.9.3-8 Q8 x86_64
2352- Pillow 3.2.0
2453- Pillow-SIMD 3.2.0.post1
2554
26- Source | Operation | IM | Pillow | SIMD SSE4 | SIMD AVX2
27- ----------|-----------------------------|------|--------|-----------|-----------
28- 7712x4352 | Bilinear resize to 16x16 | 27.0 | 217 | 456 | 545
29- | Bilinear resize to 320x180 | 32.0 | 166 | 354 | 410
30- | Bilinear resize to 2048x1155| 20.7 | 87.6 | 202 | 217
31- | Bicubic resize to 16x16 | 10.9 | 115 | 240 | 278
32- | Bicubic resize to 320x180 | 16.5 | 92.3 | 198 | 204
33- | Bicubic resize to 2048x1155 | 12.2 | 65.7 | 126 | 130
34- | Lanczos resize to 16x16 | 6.6 | 76.1 | 162 | 194
35- | Lanczos resize to 320x180 | 11.0 | 63.2 | 133 | 147
36- | Lanczos resize to 2048x1155 | 8.7 | 41.3 | 88.2 | 95.6
37- | Blur 1px | 8.1 | 17.1 | 37.8
38- | Blur 10px | 2.6 | 17.4 | 39.0
39- | Blur 100px | 0.3 | 17.2 | 39.0
40- 1920x1280 | Bilinear resize to 16x16 | 41.6 | 196 | 422 | 489
41- | Bilinear resize to 320x180 | 27.6 | 111 | 196 | 197
42- | Bilinear resize to 2048x1155| 9.1 | 20.7 | 71.3 | 72.6
43- | Bicubic resize to 16x16 | 18.9 | 102 | 225 | 263
44- | Bicubic resize to 320x180 | 14.5 | 66.3 | 154 | 162
45- | Bicubic resize to 2048x1155 | 6.3 | 16.9 | 49.3 | 54.3
46- | Lanczos resize to 16x16 | 13.7 | 68.6 | 118 | 167
47- | Lanczos resize to 320x180 | 9.8 | 44.3 | 102 | 107
48- | Lanczos resize to 2048x1155 | 4.7 | 14.6 | 36.8 | 40.6
49- | Blur 1px | 8.7 | 16.2 | 35.7
50- | Blur 10px | 2.8 | 16.7 | 35.4
51- | Blur 100px | 0.4 | 16.4 | 36.2
52-
55+ Source | Operation | Filter | IM | Pillow | SIMD SSE4 | SIMD AVX2
56+ ----------|---------------------|---------|------|--------|-----------|-----------
57+ 7712x4352 | Resize to 16x16 | Bilinear| 27.0 | 217 | 456 | 545
58+ | | Bicubic | 10.9 | 115 | 240 | 278
59+ | | Lanczos | 6.6 | 76.1 | 162 | 194
60+ | Resize to 320x180 | Bilinear| 32.0 | 166 | 354 | 410
61+ | | Bicubic | 16.5 | 92.3 | 198 | 204
62+ | | Lanczos | 11.0 | 63.2 | 133 | 147
63+ | Resize to 2048x1155 | Bilinear| 20.7 | 87.6 | 202 | 217
64+ | | Bicubic | 12.2 | 65.7 | 126 | 130
65+ | | Lanczos | 8.7 | 41.3 | 88.2 | 95.6
66+ | Blur | 1px | 8.1 | 17.1 | 37.8
67+ | | 10px | 2.6 | 17.4 | 39.0
68+ | | 100px | 0.3 | 17.2 | 39.0
69+ 1920x1280 | Resize to 16x16 | Bilinear| 41.6 | 196 | 422 | 489
70+ | | Bicubic | 18.9 | 102 | 225 | 263
71+ | | Lanczos | 13.7 | 68.6 | 118 | 167
72+ | Resize to 320x180 | Bilinear| 27.6 | 111 | 196 | 197
73+ | | Bicubic | 14.5 | 66.3 | 154 | 162
74+ | | Lanczos | 9.8 | 44.3 | 102 | 107
75+ | Resize to 2048x1155 | Bilinear| 9.1 | 20.7 | 71.3 | 72.6
76+ | | Bicubic | 6.3 | 16.9 | 49.3 | 54.3
77+ | | Lanczos | 4.7 | 14.6 | 36.8 | 40.6
78+ | Blur | 1px | 8.7 | 16.2 | 35.7
79+ | | 10px | 2.8 | 16.7 | 35.4
80+ | | 100px | 0.4 | 16.4 | 36.2
81+
82+
83+ ### Some conclusions
84+
85+ Pillow is always faster than ImagMagick and
86+ Pillow-SIMD is always faster than Pillow.
5387
5488### Methodology
5589
@@ -60,18 +94,28 @@ Following script were using for tests:
6094https://gist.github.com/homm/f9b8d8a84a57a7e51f9c2a5828e40e63
6195
6296
63- ## Why Pillow is so fast itself
97+ ## Why Pillow itself is so fast
6498
6599There are no cheats. High-quality resize and blur methods are used for all
66100benchmakrs. And result is
67101
68102
69- ## Why Pillow-SIMD even faster
103+ ## Why Pillow-SIMD is even faster
104+
105+
106+ ## Installation
70107
71108
72109## Contributing to Pillow-SIMD
73110
74111** Important.** Pillow-SIMD and Pillow are two separate projects.
75112Please submit bugs and improvements not related to SIMD to
76- [ original Pillow] ( https://github.com/python-pillow/Pillow/ issues/new ) .
113+ [ original Pillow] [ original- issues] .
77114All bugs and fixes in Pillow will appear in next Pillow-SIMD version automatically.
115+
116+
117+ [ original-docs ] : http://pillow.readthedocs.io/
118+ [ original-issues ] : https://github.com/python-pillow/Pillow/issues/new
119+ [ original-changelog ] : https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst
120+ [ original-contribute ] : https://github.com/python-pillow/Pillow/blob/master/.github/CONTRIBUTING.md
121+ [ gaussian-blur-changes ] : http://pillow.readthedocs.io/en/3.2.x/releasenotes/2.7.0.html#gaussian-blur-and-unsharp-mask
0 commit comments