Beispiel #1
0
// float-rgb conversion
FloatImage* rgbToFloat(const ColorImage& src, FloatImage* dst)
{
    FloatImage* result = createResultBuffer(src.width()*3, src.height(), dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiConvert_8u32f_C3R(src.getPixelPointer(), src.getStepsize(),
                                              result->getPixelPointer(), result->getStepsize(),
                                              makeROIFullImage(src));

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    #else
        const ColorImage::Pixel* pSrc;
              FloatImage::Pixel* pDst;
        for(int y=0; y<src.height(); ++y) {
            pSrc = src.getPixelPointerY(y);
            pDst = result->getPixelPointerY(y);
            for(int x=0; x<3*src.width(); ++x,++pSrc,++pDst)
                *pDst = static_cast<Ipp32f>(*pSrc);
        }
    #endif

    return result;
}
Beispiel #2
0
ColorImage* remap(const ColorImage& src, const FloatImage &px, const FloatImage &py, ColorImage* dst, int interpolation)
{
  #ifdef NICE_USELIB_IPP
        ColorImage ci(src);
        ColorImage::Pixel* cursor = ci.getPixelPointerY(0);
    *cursor++ = 0;
    *cursor++ = 0;
    *cursor = 0;

        ColorImage * result = createResultBuffer(ci.width(), ci.height(), dst);

        IppStatus ret = ippiRemap_8u_C3R(ci.getPixelPointer(), makeROIFullImage(ci), ci.getStepsize(),
                                        makeRectFullImage(ci),
                                        px.getPixelPointer(), px.getStepsize(),
                                        py.getPixelPointer(), py.getStepsize(),
                                        result->getPixelPointer(), result->getStepsize(),
                                        makeROIFullImage(ci), interpolation);

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

        return result;
    #else // NICE_USELIB_IPP
        fthrow(ImageException,"Not yet supported without IPP.");
    #endif // NICE_USELIB_IPP
}
Beispiel #3
0
Image* floatToGrayScaled(const FloatImage& src, Ipp32f fmin, Ipp32f fmax, Image* dst)
{
    Image* result = createResultBuffer(src.width(), src.height(), dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiScale_C1R(src.getPixelPointer(), src.getStepsize(),
                                      result->getPixelPointer(), result->getStepsize(),
                                      makeROIFullImage(src), fmin, fmax);

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    #else // NICE_USELIB_IPP
        double k = 255/(fmax-fmin);

        const Ipp32f* pSrc;
              Ipp8u*  pDst;
        for(int y=0; y<src.height(); ++y) {
            pSrc = src.getPixelPointerY(y);
            pDst = result->getPixelPointerY(y);
            for(int x=0; x<src.width(); ++x,++pSrc,++pDst)
                *pDst = static_cast<Ipp8u>(k*(*pSrc-fmin));
        }
    #endif // NICE_USELIB_IPP

    return result;
}
Beispiel #4
0
/* Used to initialize state for wolfcrypt
   return 0 on success
 */
int wolfCrypt_Init()
{
    int ret = 0;

    if (initRefCount == 0) {
    #if WOLFSSL_CRYPT_HW_MUTEX
        /* If crypto hardware mutex protection is enabled, then initialize it */
        wolfSSL_CryptHwMutexInit();
    #endif

    /* if defined have fast RSA then initialize Intel IPP */
    #ifdef HAVE_FAST_RSA
        WOLFSSL_MSG("Attempting to use optimized IPP Library");
        if ((ret = ippInit()) != ippStsNoErr) {
            /* possible to get a CPU feature support status on optimized IPP
              library but still use default library and see competitive speeds */
            WOLFSSL_MSG("Warning when trying to set up optimization");
            WOLFSSL_MSG(ippGetStatusString(ret));
            WOLFSSL_MSG("Using default fast IPP library");
            ret = 0;
        }
    #endif

    #ifdef WOLFSSL_ARMASM
        WOLFSSL_MSG("Using ARM hardware acceleration");
    #endif

        initRefCount = 1;
    }

    return ret;
}
Beispiel #5
0
ColorImage* rgbToHSV(const ColorImage& src, ColorImage* dst)
{
    ColorImage* result = createResultBuffer(src, dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiRGBToHSV_8u_C3R(src.getPixelPointer(), src.getStepsize(),
                                            result->getPixelPointer(), result->getStepsize(),
                                            makeROIFullImage(src));

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    #else // NICE_USELIB_IPP
        double min,max,diff,  r,g,b,  h;

        const Ipp8u* pSrcStart = src.getPixelPointer();
        Ipp8u* pDstStart       = result->getPixelPointer();

        const Ipp8u* pSrc;
              Ipp8u* pDst;
        for(int y=0; y<src.height(); ++y) {
            pSrc = pSrcStart;
            pDst = pDstStart;

            for(int x=0; x<src.width(); ++x) {
                r   = *pSrc/255.0; ++pSrc;
                g   = *pSrc/255.0; ++pSrc;
                b   = *pSrc/255.0; ++pSrc;

                min  = std::min(g,b);
                min  = std::min(r, min);

                max  = std::max(g,b);
                max  = std::max(r, max);

                diff = max-min;

                // H
                h = 0;
                if(diff!=0) {
                    if(max==r)      { h = ((g-b)/diff    )*60; }
                    else if(max==g) { h = ((b-r)/diff + 2)*60; }
                    else if(max==b) { h = ((r-g)/diff + 4)*60; }
				}
                h += (h<0)?360:0;

                *pDst = static_cast<unsigned char>(h*17/24);                   ++pDst; // *255/360
                *pDst = static_cast<unsigned char>((max==0)?0:(diff*255)/max); ++pDst;
                *pDst = static_cast<unsigned char>(max*255);                   ++pDst; // v = max;
            }

            pSrcStart += src.getStepsize();
            pDstStart += result->getStepsize();
        }
    #endif // NICE_USELIB_IPP

    return result;
}
void IppErrorMessage(CString funcName, IppStatus status)
{
    if (status == 0) return;
    CString message;
    message.Format("%s in %s:\nIppStatus = %d:\n%s",
                   status < 0 ? "Error" : "Warning",
                   funcName, status, ippGetStatusString(status));
    AfxGetMainWnd()->MessageBox(message, AfxGetAppName(),
                                (status < 0) ? MB_OK | MB_ICONWARNING : MB_OK);
}
Beispiel #7
0
ColorImage* yuvToRGB(const ColorImage& src, ColorImage* dst)
{
    ColorImage* result = createResultBuffer(src.width(), src.height(), dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiYUVToRGB_8u_C3R(src.getPixelPointer(), src.getStepsize(),
                                            result->getPixelPointer(), result->getStepsize(),
                                            makeROIFullImage(src));

        if(ret!=ippStsNoErr)
                fthrow(ImageException, ippGetStatusString(ret));

    #else // NICE_USELIB_IPP
        double y,u,v, r,g,b;

        const Ipp8u* pSrcStart = src.getPixelPointer();
        Ipp8u* pDstStart       = result->getPixelPointer();

        const ColorImage::Pixel* pSrc;
              ColorImage::Pixel* pDst;
        for(int ty=0; ty<src.height(); ++ty) {
            pSrc = pSrcStart;
            pDst = pDstStart;

            for(int tx=0; tx<src.width(); ++tx) {
                y = *pSrc/255.0;     ++pSrc;
                u = *pSrc/255.0-0.5; ++pSrc;
                v = *pSrc/255.0-0.5; ++pSrc;

                r = y + 1.140*v;
                g = y - 0.394*u - 0.581*v;
                b = y + 2.032*u;

                r = std::min(1.0, r);
                r = std::max(0.0, r);

                g = std::min(1.0, g);
                g = std::max(0.0, g);

                b = std::min(1.0, b);
                b = std::max(0.0, b);

                *pDst = static_cast<Ipp8u>(r*255); ++pDst;
                *pDst = static_cast<Ipp8u>(g*255); ++pDst;
                *pDst = static_cast<Ipp8u>(b*255); ++pDst;
            }

            pSrcStart += src.getStepsize();
            pDstStart += result->getStepsize();
        }
    #endif // NICE_USELIB_IPP

    return result;
}
Beispiel #8
0
ColorImage* rgbToYUV(const ColorImage& src, ColorImage* dst)
{
    ColorImage* result = createResultBuffer(src.width(), src.height(), dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiRGBToYUV_8u_C3R(src.getPixelPointer(), src.getStepsize(),
                                            result->getPixelPointer(), result->getStepsize(),
                                            makeROIFullImage(src));

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    #else // NICE_USELIB_IPP
        double r,g,b, y,u,v;

        const Ipp8u* pSrcStart = src.getPixelPointer();
        Ipp8u* pDstStart       = result->getPixelPointer();

        const ColorImage::Pixel* pSrc;
              ColorImage::Pixel* pDst;
        for(int ty=0; ty<src.height(); ++ty) {
            pSrc = pSrcStart;
            pDst = pDstStart;

            for(int tx=0; tx<src.width(); ++tx) {
                r = *pSrc/255.0; ++pSrc;
                g = *pSrc/255.0; ++pSrc;
                b = *pSrc/255.0; ++pSrc;

                y = 0.299*r + 0.587*g + 0.114*b;
                u = 0.492*(b-y);
                v = 0.877*(r-y);

                v+= 0.5;
                v = std::max(0.0, v);
                v = std::min(1.0, v);

                *pDst = static_cast<Ipp8u>(y*255);       ++pDst;
                *pDst = static_cast<Ipp8u>((u+0.5)*255); ++pDst;
                *pDst = static_cast<Ipp8u>(v*255);       ++pDst;
            }

            pSrcStart += src.getStepsize();
            pDstStart += result->getStepsize();
        }
    #endif // NICE_USELIB_IPP

    return result;
}
Beispiel #9
0
Image* remap(const Image& src, const FloatImage &px, const FloatImage &py, Image* dst, int interpolation)
{
  #ifdef NICE_USELIB_IPP
        Image * result = createResultBuffer(src.width(), src.height(), dst);

        Image gi(src);
        *(gi.getPixelPointerY(0)) = 0;

    IppStatus ret = ippiRemap_8u_C1R(gi.getPixelPointer(), makeROIFullImage(src), gi.getStepsize(),
             makeRectFullImage(gi), px.getPixelPointer(), px.getStepsize(),
             py.getPixelPointer(), py.getStepsize(),
             result->getPixelPointer(), result->getStepsize(),
             makeROIFullImage(gi), interpolation);

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    return result;
  #else // NICE_USELIB_IPP
    fthrow(ImageException,"Not yet supported without IPP.");
  #endif // NICE_USELIB_IPP
}
Beispiel #10
0
ColorImage* hsvToRGB(const ColorImage& src, ColorImage* dst)
{
    ColorImage* result = createResultBuffer(src.width(), src.height(), dst);

    #ifdef NICE_USELIB_IPP
        IppStatus ret = ippiHSVToRGB_8u_C3R(src.getPixelPointer(), src.getStepsize(),
                                            result->getPixelPointer(), result->getStepsize(),
                                            makeROIFullImage(src));

        if(ret!=ippStsNoErr)
            fthrow(ImageException, ippGetStatusString(ret));

    #else // NICE_USELIB_IPP
        double h,s,v, r,g,b, k,m,n, f;
        int    i;

        const Ipp8u* pSrcStart = src.getPixelPointer();
        Ipp8u* pDstStart       = result->getPixelPointer();

        const ColorImage::Pixel* pSrc;
              ColorImage::Pixel* pDst;
        for(int y=0; y<src.height(); ++y) {
            pSrc = pSrcStart;
            pDst = pDstStart;

            for(int x=0; x<src.width(); ++x) {
                h   =(*pSrc/255.0)*360; ++pSrc;
                s   = *pSrc/255.0;      ++pSrc;
                v   = *pSrc/255.0;      ++pSrc;

                r = g = b = v; // default case if s==0

                if(s!=0) {
                    h = (h==360)?0:h/60;

                    i = static_cast<int>(h);
                    f = h-i;
                    m = v*(1-s);
                    n = v*(1-s*f);
                    k = v*(1-s*(1-f));

                    switch(i) {
                        case 0: r = v; g = k; b = m; break;
                        case 1: r = n; g = v; b = m; break;
                        case 2: r = m; g = v; b = k; break;
                        case 3: r = m; g = n; b = v; break;
                        case 4: r = k; g = m; b = v; break;
                        case 5: r = v; g = m; b = n; break;
                    }
                }

                *pDst = static_cast<Ipp8u>(r*255); ++pDst;
                *pDst = static_cast<Ipp8u>(g*255); ++pDst;
                *pDst = static_cast<Ipp8u>(b*255); ++pDst;
            }

            pSrcStart += src.getStepsize();
            pDstStart += result->getStepsize();
       }
    #endif // NICE_USELIB_IPP

    return(result);
}
Beispiel #11
0
//실행부분
void CIPPDlg::OnBnClickedButton1()
{
	UpdateData(TRUE);
	CWaitCursor wait;
	LARGE_INTEGER frequency, tStart, tEnd;
	QueryPerformanceFrequency(&frequency);
	IppiSize maskSize = { 3, 3 };
	IppiPoint anchor = { 1, 1 };
	IppiSize sizeSrc = { m_nWidth, m_nHeight };
	IppiSize sizeDst = { m_nWidth, m_nHeight };
	IppiSize szFiltter = { m_nWidth - 2, m_nHeight - 2 };// Filter ROI Size 3x3=2, 5x5=4

	// Step Size
	int nStepSrc = (8 * sizeSrc.width + 31) / 32 * 4;// Step = ((BitSize * Width + 31) / 32) * 4
	int nStepDst = (8 * sizeDst.width + 31) / 32 * 4;
	int nStepTmp = (8 * szFiltter.width + 31) / 32 * 4;
	// 메모리 할당
	Ipp8u* pipDataSrc = ippiMalloc_8u_C1(sizeSrc.width, sizeSrc.height, &nStepSrc);
	Ipp8u* pipDataDst = ippiMalloc_8u_C1(sizeDst.width, sizeDst.height, &nStepDst);
	//Ipp8u* pipDataTmp = (Ipp8u*)ippMalloc( nStepTmp * szFiltter.height);

	IppStatus status = ippStsNoErr;

	// 메모리 초기화
	status = ippiImageJaehne_8u_C1R(pipDataSrc, nStepSrc, sizeSrc);
	status = ippiImageJaehne_8u_C1R(pipDataDst, nStepDst, sizeDst);
	//status = ippiImageJaehne_8u_C1R(pipDataTmp, nStepTmp, szFiltter);
	GetDlgItem(IDC_STATUS)->SetWindowText(ippGetStatusString(status));
	// 원본 버퍼저장
	CStdioFile rfile1;
	rfile1.Open("c:\\ipp_8u_1.raw", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
	rfile1.Write(pipDataSrc, sizeof(Ipp8u)*nStepSrc*m_nHeight);
	rfile1.Close();

	// ROI 시작부분 계산
	Ipp8u* pipSrcROI = (Ipp8u*)(((Ipp8u*)pipDataSrc) + anchor.y * nStepSrc + anchor.x * sizeof(Ipp8u));
	Ipp8u* pipDstROI = (Ipp8u*)(((Ipp8u*)pipDataDst) + anchor.y * nStepDst + anchor.x * sizeof(Ipp8u));
	QueryPerformanceCounter(&tStart);
	switch (m_idxFilter)
	{
	case 0://Sharpen
		status = ippiFilterSharpen_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter);
		break;
	case 1://Lowpass
		status = ippiFilterLowpass_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, ippMskSize3x3);
		break;
	case 2://Hipass
		status = ippiFilterHipass_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, ippMskSize3x3);
		break;
	case 3://Gauss
		status = ippiFilterGauss_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, ippMskSize3x3);
		break;
	case 4://Median
		status = ippiFilterMedian_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, maskSize, anchor);
		break;
	case 5://Min
		status = ippiFilterMin_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, maskSize, anchor);
		break;
	case 6://Max
		status = ippiFilterMax_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, maskSize, anchor);
		break;
	case 7://Laplace
		status = ippiFilterLaplace_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, ippMskSize3x3);
		break;
	case 8://Wiener
	{
			   int size = 0;
			   status = ippiFilterWienerGetBufferSize(szFiltter, maskSize, 1, &size);
			   Ipp8u* pBuffer = new Ipp8u[size + 2];
			   Ipp32f noise = 0;
			   status = ippiFilterWiener_8u_C1R(pipSrcROI, nStepSrc, pipDstROI, nStepDst, szFiltter, maskSize, anchor, &noise, (Ipp8u*)pBuffer);
			   delete pBuffer;
	}
		break;
	}
	QueryPerformanceCounter(&tEnd);
	// 필터링된 버퍼저장
	CStdioFile rfile2;
	rfile2.Open("c:\\ipp_8u_2.raw", CFile::modeCreate | CFile::modeWrite | CFile::typeBinary);
	rfile2.Write(pipDataDst, sizeof(Ipp8u)*nStepDst * sizeDst.height);
	rfile2.Close();
	Ipp64f Mean = 0;
	Ipp64f StdDev = 0;
	status = ippiMean_StdDev_8u_C1R(pipDataDst, nStepDst, sizeDst, &Mean, &StdDev);
	// 메모리 해제
	ippiFree(pipDataSrc);
	ippiFree(pipDataDst);
	//ippiFree(pipDataTmp);
	GetDlgItem(IDC_STATUS)->SetWindowText(ippGetStatusString(status));

	// 수행시간 계산
	CString strTime;
	strTime.Format("%3.5f msec\r\nMean = %3.2f , StdDev = %3.2f", (double)((tEnd.QuadPart - tStart.QuadPart) / (double)frequency.QuadPart)*(double)1000., Mean, StdDev);
	GetDlgItem(IDC_TIME)->SetWindowText(strTime);

}
Beispiel #12
0
int main(int argc, char* argv[])
{
	const IppLibraryVersion *lib;
	Ipp64u fm;
	IppStatus status;

	status = ippInit();            //IPP initialization with the best optimization layer
	if (status != ippStsNoErr) {
		printf("IppInit() Error:\n");
		printf("%s\n", ippGetStatusString(status));
		return -1;
	}

	//Get version info
	lib = ippiGetLibVersion();
	printf("%s %s\n", lib->Name, lib->Version);

	//Get CPU features enabled with selected library level
	fm = ippGetEnabledCpuFeatures();
	printf("SSE    :%c\n", (fm >> 1) & 1 ? 'Y' : 'N');
	printf("SSE2   :%c\n", (fm >> 2) & 1 ? 'Y' : 'N');
	printf("SSE3   :%c\n", (fm >> 3) & 1 ? 'Y' : 'N');
	printf("SSSE3  :%c\n", (fm >> 4) & 1 ? 'Y' : 'N');
	printf("SSE41  :%c\n", (fm >> 6) & 1 ? 'Y' : 'N');
	printf("SSE42  :%c\n", (fm >> 7) & 1 ? 'Y' : 'N');
	printf("AVX    :%c\n", (fm >> 8) & 1 ? 'Y' : 'N');
	printf("AVX2   :%c\n", (fm >> 15) & 1 ? 'Y' : 'N');
	printf("----------\n");
	printf("OS Enabled AVX :%c\n", (fm >> 9) & 1 ? 'Y' : 'N');
	printf("AES            :%c\n", (fm >> 10) & 1 ? 'Y' : 'N');
	printf("CLMUL          :%c\n", (fm >> 11) & 1 ? 'Y' : 'N');
	printf("RDRAND         :%c\n", (fm >> 13) & 1 ? 'Y' : 'N');
	printf("F16C           :%c\n", (fm >> 14) & 1 ? 'Y' : 'N');

	ln32f();

	//LN函数性能测试
	srand(0);
	GenerateSrcData();

	int t = 0;

	//t = StdLn();
	//printf("StdLn Time = %d\n",t);

	//t = PPL_StdLn();
	//printf("PPL_StdLn Time = %d\n", t);

	//t = TBB_StdLn();
	//printf("TBB_StdLn Time = %d\n", t);

	//t = StdLn_I();
	//printf("StdLn_I Time = %d\n", t);

	//t = IppLn();
	//printf("IppLn Time = %d\n", t);

	//t = IppLn_I();
	//printf("IppLn_I Time = %d\n", t);

	t = PPL_IppLn_I();
	printf("PPL_IppLn_I Time = %d\n", t);

	//t = TBB_IppLn_I();
	//printf("TBB_IppLn_I Time = %d\n", t);

	//for (int i = 0; i < sizeof(DstData) / sizeof(DstData[0]); i++)
	//{
	//	if (fabs(DstData[i] - DstData2[i]) > 1e-6)
	//	{
	//		printf("Error: %d, %f, %f\n", i, DstData[i], DstData2[i]);
	//	}
	//}

	return 0;
}
Beispiel #13
0
/* Used to initialize state for wolfcrypt
   return 0 on success
 */
int wolfCrypt_Init(void)
{
    int ret = 0;

    if (initRefCount == 0) {
        WOLFSSL_ENTER("wolfCrypt_Init");

    #ifdef WOLFSSL_ASYNC_CRYPT
        ret = wolfAsync_HardwareStart();
        if (ret != 0) {
            WOLFSSL_MSG("Async hardware start failed");
            /* don't return failure, allow operation to continue */
        }
    #endif

    #if defined(WOLFSSL_TRACK_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
        ret = InitMemoryTracker();
        if (ret != 0) {
            WOLFSSL_MSG("InitMemoryTracker failed");
            return ret;
        }
    #endif

    #if WOLFSSL_CRYPT_HW_MUTEX
        /* If crypto hardware mutex protection is enabled, then initialize it */
        ret = wolfSSL_CryptHwMutexInit();
        if (ret != 0) {
            WOLFSSL_MSG("Hw crypt mutex init failed");
            return ret;
        }
    #endif

    /* if defined have fast RSA then initialize Intel IPP */
    #ifdef HAVE_FAST_RSA
        WOLFSSL_MSG("Attempting to use optimized IPP Library");
        if ((ret = ippInit()) != ippStsNoErr) {
            /* possible to get a CPU feature support status on optimized IPP
              library but still use default library and see competitive speeds */
            WOLFSSL_MSG("Warning when trying to set up optimization");
            WOLFSSL_MSG(ippGetStatusString(ret));
            WOLFSSL_MSG("Using default fast IPP library");
            ret = 0;
            (void)ret; /* suppress not read warning */
        }
    #endif

    #if defined(FREESCALE_LTC_TFM) || defined(FREESCALE_LTC_ECC)
        ret = ksdk_port_init();
        if (ret != 0) {
            WOLFSSL_MSG("KSDK port init failed");
            return ret;
        }
    #endif

    #ifdef WOLFSSL_ATMEL
        atmel_init();
    #endif

    #ifdef WOLFSSL_ARMASM
        WOLFSSL_MSG("Using ARM hardware acceleration");
    #endif

    #if !defined(WOLFCRYPT_ONLY) && \
        ( defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) )
        wolfSSL_EVP_init();
    #endif

    #if defined(OPENSSL_EXTRA) || defined(DEBUG_WOLFSSL_VERBOSE)
        if ((ret = wc_LoggingInit()) != 0) {
            WOLFSSL_MSG("Error creating logging mutex");
            return ret;
        }
    #endif

#ifdef HAVE_ECC
    #ifdef ECC_CACHE_CURVE
        if ((ret = wc_ecc_curve_cache_init()) != 0) {
            WOLFSSL_MSG("Error creating curve cache");
            return ret;
        }
    #endif
#endif

        initRefCount = 1;
    }

    return ret;
}