ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.03k stars 406 forks source link

Resize methods #189

Closed mikeversteeg closed 2 years ago

mikeversteeg commented 2 years ago

I've been trying out the various resize methods in Windows 10 (YUV420/HD) and came to the following conclusions..

SimdResizeMethodNearest Fast, bbut when scaling down to less than 25% some images look awful (lines disappear).

SimdResizeMethodNearestPytorch Somewhat better, but still useless for less than 25%.

SimdResizeMethodBilinear Big improvement with hardly more CPU usage.

SimdResizeMethodBilinearCaffe SimdResizeMethodBilinearPytorch Do not work.

SimdResizeMethodArea Very nice, but CPU usage doubles.

So there's no perfect solution. I thought dynamically picking the method based on the amount of scaling would work, but even when resizing to 20% of original SimdResizeMethodArea still uses around 50% more CPU. I'm very curious of the results of SimdResizeMethodBilinearCaffe and SimdResizeMethodBilinearPytorch for <25% scaling but they give garbled video.

ermig1979 commented 2 years ago

It is my mistake. SimdResizeMethodBilinearCaffe and SimdResizeMethodBilinearPytorch work only with float image. I forgot to note this in docs. The methods are need for compatibility (as and SimdResizeMethodNearestPytorch). I would to recommend to use (SimdResizeMethodNearest, SimdResizeMethodBilinear, SimdResizeMethodArea) methods. SimdResizeMethodArea is designed to large reduce image.

ermig1979 commented 2 years ago

I have plan to add Bicubic interpolation.

mikeversteeg commented 2 years ago

I'm looking forward trying out Bicubic!