Example #1
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;
}
Example #2
0
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

#include "precomp.hpp"
#include "opencl_kernels.hpp"

#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
static IppStatus sts = ippInit();
#endif

namespace cv
{

template<typename T, typename ST, typename QT>
void integral_( const T* src, size_t _srcstep, ST* sum, size_t _sumstep,
                QT* sqsum, size_t _sqsumstep, ST* tilted, size_t _tiltedstep,
                Size size, int cn )
{
    int x, y, k;

    int srcstep = (int)(_srcstep/sizeof(T));
    int sumstep = (int)(_sumstep/sizeof(ST));
    int tiltedstep = (int)(_tiltedstep/sizeof(ST));
Example #3
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;
}
Example #4
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;
}