RGB to/from Gray rewritten to wide intrinsics#13379
Merged
alalek merged 16 commits intoopencv:3.4from Dec 14, 2018
Merged
Conversation
alalek
approved these changes
Dec 7, 2018
modules/imgproc/src/color_rgb.cpp
Outdated
| #if CV_SIMD | ||
| const int vsize = v_uint8::nlanes; | ||
| v_uint8 vz = vx_setzero_u8(), vn0 = vx_setall_u8(255); | ||
| for(; i < n-vsize+1; |
Member
There was a problem hiding this comment.
i < n-vsize+1
Other code uses this form for vectorized loops:
i <= n - vsize
terfendail
reviewed
Dec 11, 2018
|
|
||
| if( gb == 6 ) | ||
| { | ||
| g0 = ((t0 >> 5) << 10) >> 8; |
Contributor
There was a problem hiding this comment.
Wouldn't one bit-mask be faster than two shifts?
Contributor
Author
There was a problem hiding this comment.
I did exactly that in the beginng then decided to use shifts instead since masking requres one extra register for mask.
Can't figure out which code works faster. Their performance differs less than between any two runs of identical code.
Contributor
Author
|
@alalek ARM builds fixed |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge with extra: opencv/opencv_extra#560
This pullrequest changes
color_rgb.cpprewritten to wide universal intrinsicsmRGBA2RGBA: saturation addedmaster branch has different RGB2Gray coefficients so there will be separate PR
Performance
Baseline AVX2
Baseline AVX512SKX
Baseline SSE2
Baseline SSE4.1
Not covered
Several conversions are not covered by perf tests so their performance was estimated with custom test: random image 511x511, time measured by loop of 20000 identical calls, averaged by 5 runs.Resulting improvement depends on baseline and number of channels but doesn't differ significantly:
RGB2Gray<float>:RGB5x52Gray:RGB2Gray<ushort>:RGBA2mRGBA<uchar>:*
mRGBA2RGBA<uchar>: