opencv-rust icon indicating copy to clipboard operation
opencv-rust copied to clipboard

SIMD (universal intrinsics) support?

Open fzyzcjy opened this issue 4 years ago • 7 comments

Hi thanks for this lib! I wonder how we can have support for SIMD, i.e. universal intrinsics? Because this can boost the speed by, say, 4x!

fzyzcjy avatar Sep 27 '21 09:09 fzyzcjy

Hi, are you referring to the particular (missing) APIs that are present in the C++ OpenCV? If so, can you please name them? Because otherwise I believe SIMD support depends on how the OpenCV itself is built.

twistedfall avatar Sep 27 '21 11:09 twistedfall

@twistedfall Hi I mean this: https://docs.opencv.org/4.5.3/df/d91/group__core__hal__intrin.html

fzyzcjy avatar Sep 27 '21 11:09 fzyzcjy

I see, I’ll see if those can be exported

twistedfall avatar Sep 30 '21 06:09 twistedfall

Well after 3 days poking around the source code of this lib, I feel it may not be very possible. If I understand correctly, this binding will add try-catch on every call from rust to C++. However, intrinsics are very low-level and will be called with very high frequency indeed. So exporting it will make it not useful anymore...

fzyzcjy avatar Sep 30 '21 06:09 fzyzcjy

You can mark functions as infallible, then the try/catch will be skipped. But I understand the performance implications, I’ll keep that in mind.

twistedfall avatar Sep 30 '21 06:09 twistedfall

This is actionable, so let's leave this open

twistedfall avatar Oct 09 '21 07:10 twistedfall

Ok

fzyzcjy avatar Oct 09 '21 08:10 fzyzcjy