AccessViolation exception in using ippiHistogram_32f_C1R

AccessViolation exception in using ippiHistogram_32f_C1R

Hi,

We are getting AccessViolationException in a call to ippiHistogram_32f_C1R every now and then, and it leads to a crash in our application. 

We're using Ipp 2019 Update 1, and here is the code (the line in bold leads to AccessViolationException). 

  • In HandleReturnValue, we check if the return value is different than 0, and if so we throw the proper exception.
  • img.Step is generated by a call to ippiMalloc_32f_C1. 

Could you point us to where the error might be?

public static uint[] Histogram(VMImage img, int band, float[] levels)
{
    short ippStatus = 0;
    int[] nLevels = { levels.Length };
    int sizeHistObj, sizeBuffer;
    IppiHistogramSpec* histSpec = null;
    byte* histBuffer = null;
    uint[] hist = new uint[levels.Length - 1];

    fixed (uint* pHist = &hist[0])
    {
        fixed (float* pLevels0 = &levels[0])
        {
            float*[] pLevels = { pLevels0 };
            fixed (float** ppLevels = &pLevels[0])
            {
                // Get sizes for spec and buffer
                ippStatus = ippiHistogramGetBufferSize(IppDataType.ipp32f, img.GetRoiSize(), nLevels, 1/*nChan*/, 0/*user step*/, &sizeHistObj, &sizeBuffer);
                HandleReturnValue(ippStatus);
                // Allocation of buffers
                histSpec = (IppiHistogramSpec*)ippsMalloc_8u(sizeHistObj);
                histBuffer = (byte*)ippsMalloc_8u(sizeBuffer);
                // Initialize spec
                ippStatus = ippiHistogramInit(IppDataType.ipp32f, ppLevels, nLevels, 1/*nChan*/, histSpec);
                HandleReturnValue(ippStatus);
                // Calculate histogram
                ippStatus = ippiHistogram_32f_C1R((float*)img.GetRoiPointer(band), img.Step, img.GetRoiSize(), pHist, histSpec, histBuffer);
                HandleReturnValue(ippStatus);
            }
        }
    }

    // CleanUp
    if (histSpec != null)
    {
        ippsFree(histSpec);
    }
    if (histBuffer != null)
    {
        ippsFree(histBuffer);
    }

    return hist;
}
 

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

here is an unknown issue with IPP v.2019.  Do you see if the problem happens with some specific input images or it happens anytime? 

at the very first glance, everything looks as expected. We need to have a comprehensive example to build and run on our side.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya