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.01k stars 407 forks source link

AVX2 Resize assertion #257

Closed sbudenkov closed 12 months ago

sbudenkov commented 1 year ago

Hi,

We are observing the following issue. If create a resizer using bilinear algorithm but for an image where height is 1 an assertion will be raised. https://github.com/ermig1979/Simd/blob/master/src/Simd/SimdAvx2Resizer.cpp#L38

namespace Simd
{
#ifdef SIMD_AVX2_ENABLE 
    namespace Avx2
    {
        void * ResizerInit(size_t srcX, size_t srcY, size_t dstX, size_t dstY, size_t channels, SimdResizeChannelType type, SimdResizeMethodType **method**)
        {
            ResParam param(srcX, srcY, dstX, dstY, channels, type, method, sizeof(__m256i));
            **if (param.IsNearest() && dstX >= F)**
                return new ResizerNearest(param);

Nearest Neighbor algorithm will be selected but the method is bilinear was set by user and saved into param structure.

After that an assertion will be raised: https://github.com/ermig1979/Simd/blob/d2eae69992ef8f2748cd7db4a68cf058f89c1a82/src/Simd/SimdBaseResizerNearest.cpp#L67

ermig1979 commented 1 year ago

Thank for bug report! I fixed this bug.