Skip to content

Morphology reworked to use wide universal intrinsics - #13610

Merged
opencv-pushbot merged 1 commit into
opencv:3.4from
terfendail:morph_wintr
Jan 15, 2019
Merged

opencv-pushbot merged 1 commit into
opencv:3.4from
terfendail:morph_wintr

Conversation

@terfendail

@terfendail terfendail commented Jan 10, 2019 •

Copy link
Copy Markdown
Contributor

This pullrequest changes

Morphology reworked to use wide universal intrinsics

TODO:

  • Performance report for SSE4.2 / AVX2

@terfendail
terfendail force-pushed the morph_wintr branch 2 times, most recently from bba2f77 to b72ea55 Compare January 11, 2019 20:44
@terfendail

Copy link
Copy Markdown
Contributor Author
Performance for SSE2 baseline
Performance test Reference time PR time Speedup
dilate::Size_MatType::(320x240, 8UC1) 0.017 0.014 1.29
dilate::Size_MatType::(320x240, 16UC1) 0.028 0.022 1.32
dilate::Size_MatType::(320x240, 16SC1) 0.027 0.019 1.41
dilate::Size_MatType::(320x240, 32FC1) 0.047 0.033 1.44
dilate::Size_MatType::(320x240, 8UC4) 0.052 0.037 1.43
dilate::Size_MatType::(320x240, 16UC4) 0.115 0.078 1.48
dilate::Size_MatType::(320x240, 16SC4) 0.105 0.072 1.45
dilate::Size_MatType::(320x240, 32FC4) 0.207 0.148 1.39
dilate::Size_MatType::(640x480, 8UC1) 0.055 0.038 1.44
dilate::Size_MatType::(640x480, 16UC1) 0.116 0.078 1.49
dilate::Size_MatType::(640x480, 16SC1) 0.104 0.072 1.45
dilate::Size_MatType::(640x480, 32FC1) 0.197 0.144 1.37
dilate::Size_MatType::(640x480, 8UC4) 0.218 0.146 1.49
dilate::Size_MatType::(640x480, 16UC4) 0.458 0.316 1.45
dilate::Size_MatType::(640x480, 16SC4) 0.423 0.306 1.38
dilate::Size_MatType::(640x480, 32FC4) 0.795 0.616 1.29
dilate::Size_MatType::(800x600, 8UC1) 0.084 0.066 1.26
dilate::Size_MatType::(800x600, 16UC1) 0.179 0.129 1.38
dilate::Size_MatType::(800x600, 16SC1) 0.170 0.117 1.46
dilate::Size_MatType::(800x600, 32FC1) 0.308 0.231 1.33
dilate::Size_MatType::(800x600, 8UC4) 0.324 0.249 1.30
dilate::Size_MatType::(800x600, 16UC4) 0.689 0.529 1.30
dilate::Size_MatType::(800x600, 16SC4) 0.674 0.482 1.40
dilate::Size_MatType::(800x600, 32FC4) 1.409 1.114 1.26
dilate::Size_MatType::(1024x768, 8UC1) 0.144 0.100 1.45
dilate::Size_MatType::(1024x768, 16UC1) 0.284 0.202 1.40
dilate::Size_MatType::(1024x768, 16SC1) 0.279 0.186 1.50
dilate::Size_MatType::(1024x768, 32FC1) 0.543 0.391 1.39
dilate::Size_MatType::(1024x768, 8UC4) 0.561 0.386 1.45
dilate::Size_MatType::(1024x768, 16UC4) 1.262 0.945 1.34
dilate::Size_MatType::(1024x768, 16SC4) 1.198 0.876 1.37
dilate::Size_MatType::(1024x768, 32FC4) 2.556 2.045 1.25
dilate::Size_MatType::(1280x1024, 8UC1) 0.247 0.162 1.53
dilate::Size_MatType::(1280x1024, 16UC1) 0.489 0.336 1.45
dilate::Size_MatType::(1280x1024, 16SC1) 0.471 0.307 1.53
dilate::Size_MatType::(1280x1024, 32FC1) 0.922 0.699 1.32
dilate::Size_MatType::(1280x1024, 8UC4) 0.980 0.712 1.38
dilate::Size_MatType::(1280x1024, 16UC4) 2.213 1.705 1.30
dilate::Size_MatType::(1280x1024, 16SC4) 2.098 1.590 1.32
dilate::Size_MatType::(1280x1024, 32FC4) 4.459 3.739 1.19
erode::Size_MatType::(320x240, 8UC1) 0.032 0.024 1.32
erode::Size_MatType::(320x240, 16UC1) 0.032 0.023 1.39
erode::Size_MatType::(320x240, 16SC1) 0.026 0.018 1.42
erode::Size_MatType::(320x240, 32FC1) 0.044 0.032 1.37
erode::Size_MatType::(320x240, 8UC4) 0.050 0.035 1.42
erode::Size_MatType::(320x240, 16UC4) 0.127 0.079 1.60
erode::Size_MatType::(320x240, 16SC4) 0.100 0.069 1.44
erode::Size_MatType::(320x240, 32FC4) 0.201 0.153 1.31
erode::Size_MatType::(640x480, 8UC1) 0.053 0.038 1.40
erode::Size_MatType::(640x480, 16UC1) 0.132 0.085 1.55
erode::Size_MatType::(640x480, 16SC1) 0.107 0.073 1.46
erode::Size_MatType::(640x480, 32FC1) 0.198 0.146 1.36
erode::Size_MatType::(640x480, 8UC4) 0.210 0.151 1.39
erode::Size_MatType::(640x480, 16UC4) 0.534 0.351 1.52
erode::Size_MatType::(640x480, 16SC4) 0.423 0.319 1.32
erode::Size_MatType::(640x480, 32FC4) 0.807 0.631 1.28
erode::Size_MatType::(800x600, 8UC1) 0.083 0.062 1.33
erode::Size_MatType::(800x600, 16UC1) 0.208 0.128 1.62
erode::Size_MatType::(800x600, 16SC1) 0.174 0.112 1.55
erode::Size_MatType::(800x600, 32FC1) 0.316 0.225 1.40
erode::Size_MatType::(800x600, 8UC4) 0.326 0.230 1.42
erode::Size_MatType::(800x600, 16UC4) 0.867 0.529 1.64
erode::Size_MatType::(800x600, 16SC4) 0.685 0.462 1.48
erode::Size_MatType::(800x600, 32FC4) 1.439 1.090 1.32
erode::Size_MatType::(1024x768, 8UC1) 0.148 0.094 1.56
erode::Size_MatType::(1024x768, 16UC1) 0.347 0.209 1.66
erode::Size_MatType::(1024x768, 16SC1) 0.285 0.178 1.60
erode::Size_MatType::(1024x768, 32FC1) 0.538 0.372 1.44
erode::Size_MatType::(1024x768, 8UC4) 0.556 0.394 1.41
erode::Size_MatType::(1024x768, 16UC4) 1.510 0.964 1.57
erode::Size_MatType::(1024x768, 16SC4) 1.208 0.846 1.43
erode::Size_MatType::(1024x768, 32FC4) 2.565 2.048 1.25
erode::Size_MatType::(1280x1024, 8UC1) 0.242 0.156 1.55
erode::Size_MatType::(1280x1024, 16UC1) 0.574 0.346 1.66
erode::Size_MatType::(1280x1024, 16SC1) 0.461 0.300 1.54
erode::Size_MatType::(1280x1024, 32FC1) 0.943 0.685 1.38
erode::Size_MatType::(1280x1024, 8UC4) 0.957 0.721 1.33
erode::Size_MatType::(1280x1024, 16UC4) 2.712 1.733 1.57
erode::Size_MatType::(1280x1024, 16SC4) 2.125 1.589 1.34
erode::Size_MatType::(1280x1024, 32FC4) 4.556 3.716 1.23
Performance for SSE4_2 baseline
Performance test Reference time PR time Speedup
dilate::Size_MatType::(320x240, 8UC1) 0.018 0.013 1.31
dilate::Size_MatType::(320x240, 16UC1) 0.034 0.020 1.72
dilate::Size_MatType::(320x240, 16SC1) 0.027 0.019 1.40
dilate::Size_MatType::(320x240, 32FC1) 0.045 0.032 1.40
dilate::Size_MatType::(320x240, 8UC4) 0.049 0.035 1.43
dilate::Size_MatType::(320x240, 16UC4) 0.129 0.071 1.82
dilate::Size_MatType::(320x240, 16SC4) 0.101 0.071 1.43
dilate::Size_MatType::(320x240, 32FC4) 0.200 0.157 1.27
dilate::Size_MatType::(640x480, 8UC1) 0.054 0.038 1.40
dilate::Size_MatType::(640x480, 16UC1) 0.133 0.072 1.86
dilate::Size_MatType::(640x480, 16SC1) 0.107 0.071 1.51
dilate::Size_MatType::(640x480, 32FC1) 0.197 0.140 1.41
dilate::Size_MatType::(640x480, 8UC4) 0.209 0.146 1.43
dilate::Size_MatType::(640x480, 16UC4) 0.538 0.301 1.79
dilate::Size_MatType::(640x480, 16SC4) 0.420 0.301 1.40
dilate::Size_MatType::(640x480, 32FC4) 0.791 0.604 1.31
dilate::Size_MatType::(800x600, 8UC1) 0.086 0.066 1.31
dilate::Size_MatType::(800x600, 16UC1) 0.207 0.115 1.80
dilate::Size_MatType::(800x600, 16SC1) 0.166 0.111 1.50
dilate::Size_MatType::(800x600, 32FC1) 0.303 0.222 1.36
dilate::Size_MatType::(800x600, 8UC4) 0.323 0.229 1.41
dilate::Size_MatType::(800x600, 16UC4) 0.846 0.465 1.82
dilate::Size_MatType::(800x600, 16SC4) 0.657 0.470 1.40
dilate::Size_MatType::(800x600, 32FC4) 1.378 1.073 1.28
dilate::Size_MatType::(1024x768, 8UC1) 0.145 0.098 1.47
dilate::Size_MatType::(1024x768, 16UC1) 0.328 0.181 1.81
dilate::Size_MatType::(1024x768, 16SC1) 0.255 0.182 1.40
dilate::Size_MatType::(1024x768, 32FC1) 0.500 0.368 1.36
dilate::Size_MatType::(1024x768, 8UC4) 0.526 0.369 1.42
dilate::Size_MatType::(1024x768, 16UC4) 1.469 0.861 1.71
dilate::Size_MatType::(1024x768, 16SC4) 1.176 0.845 1.39
dilate::Size_MatType::(1024x768, 32FC4) 2.537 2.025 1.25
dilate::Size_MatType::(1280x1024, 8UC1) 0.231 0.155 1.49
dilate::Size_MatType::(1280x1024, 16UC1) 0.552 0.299 1.85
dilate::Size_MatType::(1280x1024, 16SC1) 0.437 0.303 1.44
dilate::Size_MatType::(1280x1024, 32FC1) 0.903 0.682 1.32
dilate::Size_MatType::(1280x1024, 8UC4) 0.938 0.688 1.36
dilate::Size_MatType::(1280x1024, 16UC4) 2.579 1.593 1.62
dilate::Size_MatType::(1280x1024, 16SC4) 2.123 1.628 1.30
dilate::Size_MatType::(1280x1024, 32FC4) 4.419 3.724 1.19
erode::Size_MatType::(320x240, 8UC1) 0.022 0.017 1.30
erode::Size_MatType::(320x240, 16UC1) 0.029 0.019 1.52
erode::Size_MatType::(320x240, 16SC1) 0.026 0.019 1.34
erode::Size_MatType::(320x240, 32FC1) 0.042 0.032 1.30
erode::Size_MatType::(320x240, 8UC4) 0.048 0.033 1.46
erode::Size_MatType::(320x240, 16UC4) 0.104 0.070 1.49
erode::Size_MatType::(320x240, 16SC4) 0.095 0.070 1.36
erode::Size_MatType::(320x240, 32FC4) 0.189 0.150 1.26
erode::Size_MatType::(640x480, 8UC1) 0.054 0.038 1.41
erode::Size_MatType::(640x480, 16UC1) 0.112 0.071 1.57
erode::Size_MatType::(640x480, 16SC1) 0.102 0.072 1.41
erode::Size_MatType::(640x480, 32FC1) 0.187 0.146 1.29
erode::Size_MatType::(640x480, 8UC4) 0.201 0.151 1.33
erode::Size_MatType::(640x480, 16UC4) 0.442 0.309 1.43
erode::Size_MatType::(640x480, 16SC4) 0.400 0.309 1.29
erode::Size_MatType::(640x480, 32FC4) 0.791 0.650 1.22
erode::Size_MatType::(800x600, 8UC1) 0.087 0.066 1.32
erode::Size_MatType::(800x600, 16UC1) 0.174 0.116 1.49
erode::Size_MatType::(800x600, 16SC1) 0.161 0.116 1.38
erode::Size_MatType::(800x600, 32FC1) 0.292 0.231 1.27
erode::Size_MatType::(800x600, 8UC4) 0.309 0.236 1.31
erode::Size_MatType::(800x600, 16UC4) 0.694 0.488 1.42
erode::Size_MatType::(800x600, 16SC4) 0.636 0.485 1.31
erode::Size_MatType::(800x600, 32FC4) 1.374 1.133 1.21
erode::Size_MatType::(1024x768, 8UC1) 0.137 0.101 1.36
erode::Size_MatType::(1024x768, 16UC1) 0.287 0.183 1.57
erode::Size_MatType::(1024x768, 16SC1) 0.257 0.183 1.41
erode::Size_MatType::(1024x768, 32FC1) 0.495 0.392 1.26
erode::Size_MatType::(1024x768, 8UC4) 0.518 0.399 1.30
erode::Size_MatType::(1024x768, 16UC4) 1.266 0.896 1.41
erode::Size_MatType::(1024x768, 16SC4) 1.158 0.928 1.25
erode::Size_MatType::(1024x768, 32FC4) 2.510 2.098 1.20
erode::Size_MatType::(1280x1024, 8UC1) 0.222 0.166 1.34
erode::Size_MatType::(1280x1024, 16UC1) 0.462 0.298 1.55
erode::Size_MatType::(1280x1024, 16SC1) 0.431 0.297 1.45
erode::Size_MatType::(1280x1024, 32FC1) 0.915 0.700 1.31
erode::Size_MatType::(1280x1024, 8UC4) 0.922 0.720 1.28
erode::Size_MatType::(1280x1024, 16UC4) 2.259 1.601 1.41
erode::Size_MatType::(1280x1024, 16SC4) 2.071 1.697 1.22
erode::Size_MatType::(1280x1024, 32FC4) 4.388 3.659 1.20
Performance for AVX2 baseline
Performance test Reference time PR time Speedup
dilate::Size_MatType::(320x240, 8UC1) 0.017 0.013 1.30
dilate::Size_MatType::(320x240, 16UC1) 0.029 0.018 1.64
dilate::Size_MatType::(320x240, 16SC1) 0.026 0.018 1.49
dilate::Size_MatType::(320x240, 32FC1) 0.044 0.030 1.49
dilate::Size_MatType::(320x240, 8UC4) 0.049 0.030 1.64
dilate::Size_MatType::(320x240, 16UC4) 0.109 0.068 1.61
dilate::Size_MatType::(320x240, 16SC4) 0.100 0.066 1.52
dilate::Size_MatType::(320x240, 32FC4) 0.205 0.156 1.31
dilate::Size_MatType::(640x480, 8UC1) 0.052 0.035 1.50
dilate::Size_MatType::(640x480, 16UC1) 0.116 0.067 1.73
dilate::Size_MatType::(640x480, 16SC1) 0.105 0.067 1.57
dilate::Size_MatType::(640x480, 32FC1) 0.197 0.141 1.40
dilate::Size_MatType::(640x480, 8UC4) 0.208 0.146 1.42
dilate::Size_MatType::(640x480, 16UC4) 0.458 0.298 1.54
dilate::Size_MatType::(640x480, 16SC4) 0.419 0.292 1.43
dilate::Size_MatType::(640x480, 32FC4) 0.793 0.591 1.34
dilate::Size_MatType::(800x600, 8UC1) 0.084 0.063 1.34
dilate::Size_MatType::(800x600, 16UC1) 0.186 0.115 1.63
dilate::Size_MatType::(800x600, 16SC1) 0.169 0.117 1.44
dilate::Size_MatType::(800x600, 32FC1) 0.304 0.219 1.39
dilate::Size_MatType::(800x600, 8UC4) 0.321 0.221 1.45
dilate::Size_MatType::(800x600, 16UC4) 0.707 0.452 1.57
dilate::Size_MatType::(800x600, 16SC4) 0.656 0.452 1.45
dilate::Size_MatType::(800x600, 32FC4) 1.361 1.054 1.29
dilate::Size_MatType::(1024x768, 8UC1) 0.141 0.095 1.49
dilate::Size_MatType::(1024x768, 16UC1) 0.292 0.179 1.63
dilate::Size_MatType::(1024x768, 16SC1) 0.267 0.173 1.54
dilate::Size_MatType::(1024x768, 32FC1) 0.511 0.391 1.31
dilate::Size_MatType::(1024x768, 8UC4) 0.539 0.371 1.45
dilate::Size_MatType::(1024x768, 16UC4) 1.253 0.841 1.49
dilate::Size_MatType::(1024x768, 16SC4) 1.159 0.833 1.39
dilate::Size_MatType::(1024x768, 32FC4) 2.441 1.943 1.26
dilate::Size_MatType::(1280x1024, 8UC1) 0.234 0.157 1.49
dilate::Size_MatType::(1280x1024, 16UC1) 0.488 0.303 1.61
dilate::Size_MatType::(1280x1024, 16SC1) 0.450 0.306 1.47
dilate::Size_MatType::(1280x1024, 32FC1) 0.885 0.660 1.34
dilate::Size_MatType::(1280x1024, 8UC4) 0.931 0.665 1.40
dilate::Size_MatType::(1280x1024, 16UC4) 2.146 1.555 1.38
dilate::Size_MatType::(1280x1024, 16SC4) 2.013 1.532 1.31
dilate::Size_MatType::(1280x1024, 32FC4) 4.337 3.590 1.21
erode::Size_MatType::(320x240, 8UC1) 0.031 0.019 1.65
erode::Size_MatType::(320x240, 16UC1) 0.031 0.018 1.76
erode::Size_MatType::(320x240, 16SC1) 0.025 0.018 1.40
erode::Size_MatType::(320x240, 32FC1) 0.041 0.028 1.46
erode::Size_MatType::(320x240, 8UC4) 0.047 0.029 1.60
erode::Size_MatType::(320x240, 16UC4) 0.124 0.068 1.83
erode::Size_MatType::(320x240, 16SC4) 0.095 0.067 1.42
erode::Size_MatType::(320x240, 32FC4) 0.199 0.144 1.38
erode::Size_MatType::(640x480, 8UC1) 0.052 0.035 1.48
erode::Size_MatType::(640x480, 16UC1) 0.134 0.068 1.97
erode::Size_MatType::(640x480, 16SC1) 0.102 0.068 1.51
erode::Size_MatType::(640x480, 32FC1) 0.192 0.142 1.35
erode::Size_MatType::(640x480, 8UC4) 0.209 0.144 1.46
erode::Size_MatType::(640x480, 16UC4) 0.525 0.288 1.83
erode::Size_MatType::(640x480, 16SC4) 0.404 0.307 1.32
erode::Size_MatType::(640x480, 32FC4) 0.794 0.581 1.37
erode::Size_MatType::(800x600, 8UC1) 0.085 0.060 1.40
erode::Size_MatType::(800x600, 16UC1) 0.214 0.117 1.84
erode::Size_MatType::(800x600, 16SC1) 0.163 0.117 1.40
erode::Size_MatType::(800x600, 32FC1) 0.295 0.220 1.34
erode::Size_MatType::(800x600, 8UC4) 0.310 0.232 1.34
erode::Size_MatType::(800x600, 16UC4) 0.830 0.453 1.83
erode::Size_MatType::(800x600, 16SC4) 0.638 0.471 1.36
erode::Size_MatType::(800x600, 32FC4) 1.324 1.056 1.25
erode::Size_MatType::(1024x768, 8UC1) 0.136 0.097 1.41
erode::Size_MatType::(1024x768, 16UC1) 0.338 0.177 1.91
erode::Size_MatType::(1024x768, 16SC1) 0.263 0.174 1.52
erode::Size_MatType::(1024x768, 32FC1) 0.494 0.367 1.35
erode::Size_MatType::(1024x768, 8UC4) 0.526 0.377 1.40
erode::Size_MatType::(1024x768, 16UC4) 1.482 0.837 1.77
erode::Size_MatType::(1024x768, 16SC4) 1.156 0.919 1.26
erode::Size_MatType::(1024x768, 32FC4) 2.467 1.994 1.24
erode::Size_MatType::(1280x1024, 8UC1) 0.237 0.154 1.54
erode::Size_MatType::(1280x1024, 16UC1) 0.571 0.304 1.88
erode::Size_MatType::(1280x1024, 16SC1) 0.437 0.299 1.46
erode::Size_MatType::(1280x1024, 32FC1) 0.888 0.660 1.35
erode::Size_MatType::(1280x1024, 8UC4) 0.926 0.665 1.39
erode::Size_MatType::(1280x1024, 16UC4) 2.574 1.564 1.65
erode::Size_MatType::(1280x1024, 16SC4) 1.999 1.551 1.29
erode::Size_MatType::(1280x1024, 32FC4) 4.355 3.863 1.13

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Thank you 👍

@opencv-pushbot
opencv-pushbot merged commit 012e43d into opencv:3.4 Jan 15, 2019
@terfendail
terfendail deleted the morph_wintr branch January 15, 2019 12:12
@alalek alalek mentioned this pull request Jan 22, 2019
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants