GAPI Fluid: Dynamic dispatching for Split3 kernel#21441
GAPI Fluid: Dynamic dispatching for Split3 kernel#21441opencv-pushbot merged 1 commit intoopencv:4.xfrom
Conversation
|
|
||
| #define SPLIT3_SIMD(SRC, DST) \ | ||
| int split3_simd(const SRC in[], DST out1[], DST out2[], \ | ||
| DST out3[], const int width) \ |
There was a problem hiding this comment.
It makes no sense to make this function a macro for this kernel. Make this function as a normal function.
| #endif | ||
| #if CV_SIMD | ||
| w = split3_simd(in, out1, out2, out3, width); | ||
|
|
There was a problem hiding this comment.
Please remove empty line.
| //------------------------- | ||
|
|
||
| #define SPLIT3_SIMD(SRC, DST) \ | ||
| int split3_simd(const SRC in[], DST out1[], DST out2[], \ |
There was a problem hiding this comment.
It makes no sense to make this function as a macro for this kernel. Make this function as a normal function with uchar type for all parameters.
| #undef ABSDIFFC_SIMD | ||
|
|
||
| #define SPLIT3_SIMD(DST1, DST2, DST3, SRC) \ | ||
| int split3_simd(const SRC in[], DST1 out1[], DST2 out2[], \ |
There was a problem hiding this comment.
And there is only one DST type. Three different DST types are redundant.
This construction must be forward declaration for this function. So this macro would be the same as this
NOTE:
It makes no sense to make this function as a macro for this kernel. Please make this function as a usual function.
| int x = 0; \ | ||
| for (; x <= width - nlanes; x += nlanes) \ | ||
| { \ | ||
| v_uint8 a, b, c; \ |
There was a problem hiding this comment.
It would be better to move creation and initialization of these variables from the loop.
2d19f3f to
0b8d606
Compare
| { | ||
| constexpr int nlanes = v_uint8::nlanes; | ||
| int x = 0; | ||
| v_uint8 a, b, c; |
There was a problem hiding this comment.
v_uint8 a, b, c;
Why is it outside of the loop body?
Keep variables declaration near their usage.
There was a problem hiding this comment.
Is it necessary to create vectors at each iteration?
There was a problem hiding this comment.
Is necessary to keep vector values between iterations?
There was a problem hiding this comment.
Is necessary to keep vector values between iterations?
@alalek
There is no necessity to do setzero() for each iteration of the loop since they are initialized by the v_deinterleave() function before calculations. So creation and first initialization with zeroes can be moved from the loop.
There was a problem hiding this comment.
Where do you see "setzero()" here?
Good rule of thumb for local variables to declare them in place where they are used.
No need to cross for loop boundary or any other, especially for SIMD register wrappers.
8bb494b to
5e89b9a
Compare
Split3 SIMD.xlsx
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.